Skip to content

Commit c39d0c4

Browse files
Merge pull request #1259 from paoloricciuti/output-to-disk
chore: write output to disk when testing codemod
2 parents cdf5fb6 + 1c91579 commit c39d0c4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

codemod/zod-to-valibot/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__testfixtures__/*/_actual.ts

codemod/zod-to-valibot/src/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ export function defineTests(transform: Transform, selectedTests?: string[]) {
6666
{ j, jscodeshift: j, stats: () => {}, report: () => {} },
6767
{}
6868
);
69+
fs.writeFile(
70+
path.join(testPath, '_actual.ts'),
71+
output?.trim() ?? '',
72+
() => {}
73+
);
6974
expect(output?.trim()).toBe(expectedOutput.trim());
7075
});
7176
}

0 commit comments

Comments
 (0)