@@ -15,9 +15,10 @@ export const runTransformTest = (
15
15
describe ( name , ( ) => {
16
16
globbySync ( '**/*.input.*' , {
17
17
cwd : fixturePath ,
18
- absolute : true
18
+ absolute : true ,
19
+ objectMode : true
19
20
} )
20
- . map ( ( entry ) => entry . slice ( fixturePath . length ) )
21
+ . map ( ( entry ) => entry . name )
21
22
. forEach ( ( filename ) => {
22
23
const extension = path . extname ( filename )
23
24
const testName = filename . replace ( `.input${ extension } ` , '' )
@@ -31,16 +32,20 @@ export const runTransformTest = (
31
32
`${ testName } .output${ extension } `
32
33
)
33
34
34
- describe ( testName , ( ) => {
35
+ const inputFileContent = fs . readFileSync ( inputPath , 'utf8' )
36
+
37
+ const expectedOutput = fs . readFileSync ( outputPath , 'utf8' )
38
+
39
+ describe ( `${ testName } ${ extension } ` , ( ) => {
35
40
it ( 'transforms correctly' , ( ) => {
36
41
runInlineTest (
37
42
transform ,
38
43
{ } ,
39
44
{
40
45
path : testInputPath ,
41
- source : fs . readFileSync ( inputPath , 'utf8' )
46
+ source : inputFileContent
42
47
} ,
43
- fs . readFileSync ( outputPath , 'utf8' ) ,
48
+ expectedOutput ,
44
49
{ parser }
45
50
)
46
51
} )
@@ -51,9 +56,9 @@ export const runTransformTest = (
51
56
{ } ,
52
57
{
53
58
path : testInputPath ,
54
- source : fs . readFileSync ( outputPath , 'utf8' )
59
+ source : inputFileContent
55
60
} ,
56
- fs . readFileSync ( outputPath , 'utf8' ) ,
61
+ expectedOutput ,
57
62
{ parser }
58
63
)
59
64
} )
0 commit comments