@@ -17,22 +17,22 @@ const rootDir = path.dirname(__dirname);
17
17
const toPath = subPath => path . join ( rootDir , subPath ) ;
18
18
19
19
util . getAvaConfig = ( ) => ( {
20
- files : [ 'lib/*.test.js' ]
20
+ files : [
21
+ 'lib/*.test.js' ,
22
+ 'test/**/*.js'
23
+ ]
21
24
} ) ;
22
25
23
26
ruleTester . run ( 'no-import-test-files' , rule , {
24
27
valid : [
28
+ 'import test from \'ava\';' ,
29
+ 'const test = require(\'ava\');' ,
30
+ 'console.log()' ,
31
+ 'const value = require(somePath);' ,
32
+ 'var highlight = require(\'highlight.js\')' ,
25
33
{
26
- code : 'import test from \'ava\';'
27
- } ,
28
- {
29
- code : 'const test = require(\'ava\');'
30
- } ,
31
- {
32
- code : 'console.log()'
33
- } ,
34
- {
35
- code : 'const value = require(somePath);'
34
+ code : 'var highlight = require(\'highlight.js\')' ,
35
+ filename : toPath ( 'test/index.js' )
36
36
}
37
37
] ,
38
38
invalid : [
@@ -45,6 +45,11 @@ ruleTester.run('no-import-test-files', rule, {
45
45
code : 'import test from \'./foo.test.js\';' ,
46
46
filename : toPath ( 'lib/foo.js' ) ,
47
47
errors : [ { message : 'Test files should not be imported' } ]
48
+ } ,
49
+ {
50
+ code : 'import test from \'./bar.js\';' ,
51
+ filename : toPath ( 'test/foo.js' ) ,
52
+ errors : [ { message : 'Test files should not be imported' } ]
48
53
}
49
54
]
50
55
} ) ;
0 commit comments