@@ -22,22 +22,12 @@ describe("v2-to-v3", () => {
22
22
[
23
23
( fileName . match ( inputFileRegex ) as RegExpMatchArray ) [ 1 ] ,
24
24
fileName . split ( "." ) . pop ( ) as string ,
25
- ] as const ,
25
+ ] as const
26
26
) ;
27
27
28
- const getTestMetadata = async (
29
- dirPath : string ,
30
- filePrefix : string ,
31
- fileExtension : string ,
32
- ) => {
33
- const inputPath = join (
34
- dirPath ,
35
- [ filePrefix , "input" , fileExtension ] . join ( "." ) ,
36
- ) ;
37
- const outputPath = join (
38
- dirPath ,
39
- [ filePrefix , "output" , fileExtension ] . join ( "." ) ,
40
- ) ;
28
+ const getTestMetadata = async ( dirPath : string , filePrefix : string , fileExtension : string ) => {
29
+ const inputPath = join ( dirPath , [ filePrefix , "input" , fileExtension ] . join ( "." ) ) ;
30
+ const outputPath = join ( dirPath , [ filePrefix , "output" , fileExtension ] . join ( "." ) ) ;
41
31
const inputCode = await readFile ( inputPath , "utf8" ) ;
42
32
const outputCode = await readFile ( outputPath , "utf8" ) ;
43
33
@@ -48,31 +38,25 @@ describe("v2-to-v3", () => {
48
38
for ( const subDir of fixtureSubDirs ) {
49
39
describe ( subDir , ( ) => {
50
40
const subDirPath = join ( fixtureDir , subDir ) ;
51
- for ( const [ filePrefix , fileExtension ] of getTestFileMetadata (
52
- subDirPath ,
53
- ) ) {
54
- it (
55
- `transforms: ${ filePrefix } .${ fileExtension } ` ,
56
- { concurrency : true } ,
57
- async ( ) => {
58
- const { input, outputCode } = await getTestMetadata (
59
- subDirPath ,
60
- filePrefix ,
61
- fileExtension ,
62
- ) ;
63
-
64
- const output = await transform ( input , {
65
- j : jscodeshift ,
66
- jscodeshift,
67
- // biome-ignore lint/suspicious/noEmptyBlockStatements: test helper
68
- stats : ( ) => { } ,
69
- // biome-ignore lint/suspicious/noEmptyBlockStatements: test helper
70
- report : ( ) => { } ,
71
- } ) ;
72
-
73
- strictEqual ( output . trim ( ) , outputCode . trim ( ) ) ;
74
- } ,
75
- ) ;
41
+ for ( const [ filePrefix , fileExtension ] of getTestFileMetadata ( subDirPath ) ) {
42
+ it ( `transforms: ${ filePrefix } .${ fileExtension } ` , { concurrency : true } , async ( ) => {
43
+ const { input, outputCode } = await getTestMetadata (
44
+ subDirPath ,
45
+ filePrefix ,
46
+ fileExtension
47
+ ) ;
48
+
49
+ const output = await transform ( input , {
50
+ j : jscodeshift ,
51
+ jscodeshift,
52
+ // biome-ignore lint/suspicious/noEmptyBlockStatements: test helper
53
+ stats : ( ) => { } ,
54
+ // biome-ignore lint/suspicious/noEmptyBlockStatements: test helper
55
+ report : ( ) => { } ,
56
+ } ) ;
57
+
58
+ strictEqual ( output . trim ( ) , outputCode . trim ( ) ) ;
59
+ } ) ;
76
60
}
77
61
} ) ;
78
62
}
0 commit comments