@@ -21,6 +21,10 @@ util.loadAvaHelper = () => ({
2121 switch ( importPath ) {
2222 case toPath ( 'lib/foo.test.js' ) :
2323 return { isHelper : false , isSource : false , isTest : true } ;
24+ case toPath ( '../foo.test.js' ) :
25+ return { isHelper : false , isSource : false , isTest : true } ;
26+ case toPath ( '@foo/bar' ) : // Regression test for https://github.com/avajs/eslint-plugin-ava/issues/253
27+ return { isHelper : false , isSource : false , isTest : true } ;
2428 default :
2529 return { isHelper : false , isSource : false , isTest : false } ;
2630 }
@@ -36,6 +40,8 @@ const errors = [
3640ruleTester . run ( 'no-import-test-files' , rule , {
3741 valid : [
3842 'import test from \'ava\';' ,
43+ 'import foo from \'@foo/bar\';' ,
44+ 'import foo from \'/foo/bar\';' , // Classfied as not a test.
3945 'const test = require(\'ava\');' ,
4046 'console.log()' ,
4147 'const value = require(somePath);' ,
@@ -52,6 +58,11 @@ ruleTester.run('no-import-test-files', rule, {
5258 code : 'const test = require(\'./foo.test.js\');' ,
5359 filename : toPath ( 'lib/foo.js' ) ,
5460 errors
61+ } ,
62+ {
63+ code : 'const test = require(\'../foo.test.js\');' ,
64+ filename : toPath ( 'foo.js' ) ,
65+ errors
5566 }
5667 ]
5768} ) ;
0 commit comments