@@ -9,6 +9,11 @@ expect.extend({ toMatchFile })
99// To add a test, create a file in the fixtures folder and it will will run through
1010// as though it was the codeblock.
1111
12+ const defaultCompilerOptions = {
13+ // avoid extra annotations from @types /node
14+ types : [ ]
15+ }
16+
1217describe ( "with fixtures" , ( ) => {
1318 // Add all codefixes
1419 const fixturesFolder = join ( __dirname , "fixtures" )
@@ -27,7 +32,7 @@ describe("with fixtures", () => {
2732
2833 const file = readFileSync ( fixture , "utf8" )
2934
30- const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { customTags : [ "annotate" ] } )
35+ const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { customTags : [ "annotate" ] , defaultCompilerOptions } )
3136 const jsonString = format ( JSON . stringify ( cleanFixture ( fourslashed ) ) , { parser : "json" } )
3237 expect ( jsonString ) . toMatchFile ( result )
3338 } )
@@ -46,7 +51,7 @@ describe("with fixtures", () => {
4651
4752 const file = readFileSync ( fixture , "utf8" )
4853
49- const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) )
54+ const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { defaultCompilerOptions } )
5055 const jsonString = format ( JSON . stringify ( cleanFixture ( fourslashed ) ) , { parser : "json" } )
5156 expect ( jsonString ) . toMatchFile ( result )
5257 } )
@@ -65,7 +70,7 @@ describe("with fixtures", () => {
6570
6671 const file = readFileSync ( fixture , "utf8" )
6772
68- const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) )
73+ const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { defaultCompilerOptions } )
6974 const jsonString = format ( JSON . stringify ( cleanFixture ( fourslashed ) ) , { parser : "json" } )
7075 expect ( jsonString ) . toMatchFile ( result )
7176 } )
@@ -87,7 +92,7 @@ describe("with fixtures", () => {
8792
8893 let thrown = false
8994 try {
90- twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) )
95+ twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { defaultCompilerOptions } )
9196 } catch ( err ) {
9297 thrown = true
9398 if ( err instanceof Error ) expect ( err . message ) . toMatchFile ( result )
0 commit comments