@@ -9,6 +9,11 @@ expect.extend({ toMatchFile })
9
9
// To add a test, create a file in the fixtures folder and it will will run through
10
10
// as though it was the codeblock.
11
11
12
+ const defaultCompilerOptions = {
13
+ // avoid extra annotations from @types /node
14
+ types : [ ]
15
+ }
16
+
12
17
describe ( "with fixtures" , ( ) => {
13
18
// Add all codefixes
14
19
const fixturesFolder = join ( __dirname , "fixtures" )
@@ -27,7 +32,7 @@ describe("with fixtures", () => {
27
32
28
33
const file = readFileSync ( fixture , "utf8" )
29
34
30
- const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { customTags : [ "annotate" ] } )
35
+ const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { customTags : [ "annotate" ] , defaultCompilerOptions } )
31
36
const jsonString = format ( JSON . stringify ( cleanFixture ( fourslashed ) ) , { parser : "json" } )
32
37
expect ( jsonString ) . toMatchFile ( result )
33
38
} )
@@ -46,7 +51,7 @@ describe("with fixtures", () => {
46
51
47
52
const file = readFileSync ( fixture , "utf8" )
48
53
49
- const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) )
54
+ const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { defaultCompilerOptions } )
50
55
const jsonString = format ( JSON . stringify ( cleanFixture ( fourslashed ) ) , { parser : "json" } )
51
56
expect ( jsonString ) . toMatchFile ( result )
52
57
} )
@@ -65,7 +70,7 @@ describe("with fixtures", () => {
65
70
66
71
const file = readFileSync ( fixture , "utf8" )
67
72
68
- const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) )
73
+ const fourslashed = twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { defaultCompilerOptions } )
69
74
const jsonString = format ( JSON . stringify ( cleanFixture ( fourslashed ) ) , { parser : "json" } )
70
75
expect ( jsonString ) . toMatchFile ( result )
71
76
} )
@@ -87,7 +92,7 @@ describe("with fixtures", () => {
87
92
88
93
let thrown = false
89
94
try {
90
- twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) )
95
+ twoslasher ( file , extname ( fixtureName ) . substr ( 1 ) , { defaultCompilerOptions } )
91
96
} catch ( err ) {
92
97
thrown = true
93
98
if ( err instanceof Error ) expect ( err . message ) . toMatchFile ( result )
0 commit comments