@@ -48,12 +48,42 @@ describe('parser', () => {
48
48
} ) ;
49
49
} ) ;
50
50
51
+ it ( 'parseAndGenerateServices() should be called with options.errorOnTypeScriptSyntacticAndSemanticIssues overriden to false' , ( ) => {
52
+ const code = 'const valid = true;' ;
53
+ const spy = jest . spyOn ( typescriptESTree , 'parseAndGenerateServices' ) ;
54
+ const config : ParserOptions = {
55
+ loc : false ,
56
+ comment : false ,
57
+ range : false ,
58
+ tokens : false ,
59
+ sourceType : 'module' as const ,
60
+ ecmaFeatures : {
61
+ globalReturn : false ,
62
+ jsx : false ,
63
+ } ,
64
+ // ts-estree specific
65
+ filePath : './isolated-file.src.ts' ,
66
+ project : 'tsconfig.json' ,
67
+ errorOnTypeScriptSyntacticAndSemanticIssues : true ,
68
+ tsconfigRootDir : path . resolve ( __dirname , '../fixtures/services' ) ,
69
+ extraFileExtensions : [ '.foo' ] ,
70
+ } ;
71
+ parseForESLint ( code , config ) ;
72
+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
73
+ expect ( spy ) . toHaveBeenLastCalledWith ( code , {
74
+ jsx : false ,
75
+ ...config ,
76
+ errorOnTypeScriptSyntacticAndSemanticIssues : false ,
77
+ } ) ;
78
+ } ) ;
79
+
51
80
it ( '`warnOnUnsupportedTypeScriptVersion: false` should set `loggerFn: false` on typescript-estree' , ( ) => {
52
81
const code = 'const valid = true;' ;
53
82
const spy = jest . spyOn ( typescriptESTree , 'parseAndGenerateServices' ) ;
54
83
parseForESLint ( code , { warnOnUnsupportedTypeScriptVersion : true } ) ;
55
84
expect ( spy ) . toHaveBeenCalledWith ( code , {
56
85
ecmaFeatures : { } ,
86
+ errorOnTypeScriptSyntacticAndSemanticIssues : false ,
57
87
jsx : false ,
58
88
sourceType : 'script' ,
59
89
warnOnUnsupportedTypeScriptVersion : true ,
@@ -64,6 +94,7 @@ describe('parser', () => {
64
94
ecmaFeatures : { } ,
65
95
jsx : false ,
66
96
sourceType : 'script' ,
97
+ errorOnTypeScriptSyntacticAndSemanticIssues : false ,
67
98
loggerFn : false ,
68
99
warnOnUnsupportedTypeScriptVersion : false ,
69
100
} ) ;
0 commit comments