@@ -12,7 +12,7 @@ const ruleTester = new TSESLint.RuleTester({
12
12
* Project is needed to generate the parserServices
13
13
* within @typescript-eslint/parser
14
14
*/
15
- project : './tests/tsconfig.json' ,
15
+ project : './tests/fixture-project/ tsconfig.json' ,
16
16
} ,
17
17
parser : require . resolve ( '@typescript-eslint/parser' ) ,
18
18
} ) ;
@@ -47,6 +47,7 @@ ruleTester.run('tslint/config', rule, {
47
47
{
48
48
code : 'var foo = true;' ,
49
49
options : tslintRulesConfig ,
50
+ filename : './tests/fixture-project/1.ts' ,
50
51
} ,
51
52
{
52
53
filename : './tests/test-project/file-spec.ts' ,
@@ -62,13 +63,15 @@ ruleTester.run('tslint/config', rule, {
62
63
{
63
64
code : 'throw "should be ok because rule is not loaded";' ,
64
65
options : tslintRulesConfig ,
66
+ filename : './tests/fixture-project/2.ts' ,
65
67
} ,
66
68
] ,
67
69
68
70
invalid : [
69
71
{
70
72
options : [ { lintFile : './tests/test-project/tslint.json' } ] ,
71
73
code : 'throw "err" // no-string-throw' ,
74
+ filename : './tests/fixture-project/3.ts' ,
72
75
errors : [
73
76
{
74
77
messageId : 'failure' ,
@@ -84,6 +87,7 @@ ruleTester.run('tslint/config', rule, {
84
87
code : 'var foo = true // semicolon' ,
85
88
options : tslintRulesConfig ,
86
89
output : 'var foo = true // semicolon' ,
90
+ filename : './tests/fixture-project/4.ts' ,
87
91
errors : [
88
92
{
89
93
messageId : 'failure' ,
@@ -100,6 +104,7 @@ ruleTester.run('tslint/config', rule, {
100
104
code : 'var foo = true // fail' ,
101
105
options : tslintRulesDirectoryConfig ,
102
106
output : 'var foo = true // fail' ,
107
+ filename : './tests/fixture-project/5.ts' ,
103
108
errors : [
104
109
{
105
110
messageId : 'failure' ,
@@ -174,26 +179,30 @@ describe('tslint/error', () => {
174
179
} ) ;
175
180
} ) ;
176
181
177
- it ( 'should not crash if there is no tslint rules specified' , ( ) => {
182
+ it ( 'should not crash if there are no tslint rules specified' , ( ) => {
178
183
const linter = new TSESLint . Linter ( ) ;
179
184
jest . spyOn ( console , 'warn' ) . mockImplementation ( ) ;
180
185
linter . defineRule ( 'tslint/config' , rule ) ;
181
186
linter . defineParser ( '@typescript-eslint/parser' , parser ) ;
182
187
expect ( ( ) =>
183
- linter . verify ( 'foo;' , {
184
- parserOptions : {
185
- project : `${ __dirname } /test-project/tsconfig.json` ,
186
- } ,
187
- rules : {
188
- 'tslint/config' : [ 2 , { } ] ,
188
+ linter . verify (
189
+ 'foo;' ,
190
+ {
191
+ parserOptions : {
192
+ project : `${ __dirname } /test-project/tsconfig.json` ,
193
+ } ,
194
+ rules : {
195
+ 'tslint/config' : [ 2 , { } ] ,
196
+ } ,
197
+ parser : '@typescript-eslint/parser' ,
189
198
} ,
190
- parser : '@typescript-eslint/parser' ,
191
- } ) ,
199
+ ` ${ __dirname } /test-project/extra.ts` ,
200
+ ) ,
192
201
) . not . toThrow ( ) ;
193
202
194
203
expect ( console . warn ) . toHaveBeenCalledWith (
195
204
expect . stringContaining (
196
- ' Tried to lint <input> but found no valid, enabled rules for this file type and file path in the resolved configuration.' ,
205
+ ` Tried to lint ${ __dirname } /test-project/extra.ts but found no valid, enabled rules for this file type and file path in the resolved configuration.` ,
197
206
) ,
198
207
) ;
199
208
jest . resetAllMocks ( ) ;
0 commit comments