@@ -1288,7 +1288,7 @@ describe("CLIEngine", () => {
12881288
12891289 assert . throws ( ( ) => {
12901290 engine . executeOnFiles ( [ "./tests/fixtures/cli-engine/" ] ) ;
1291- } , "No files matching './tests/fixtures/cli-engine/' were found ." ) ;
1291+ } , "All files matched by './tests/fixtures/cli-engine/' are ignored ." ) ;
12921292 } ) ;
12931293
12941294 it ( "should throw an error when all given files are ignored via ignore-pattern" , ( ) => {
@@ -3628,6 +3628,55 @@ describe("CLIEngine", () => {
36283628 assert . strictEqual ( messages [ 0 ] . ruleId , "no-console" ) ;
36293629 } ) ;
36303630 } ) ;
3631+
3632+ describe ( "don't ignore the entry directory." , ( ) => {
3633+ const root = getFixturePath ( "cli-engine/dont-ignore-entry-dir" ) ;
3634+
3635+ it ( "'executeOnFiles(\".\")' should not load config files from outside of \".\"." , ( ) => {
3636+ CLIEngine = defineCLIEngineWithInMemoryFileSystem ( {
3637+ cwd : ( ) => root ,
3638+ files : {
3639+ "../.eslintrc.json" : "BROKEN FILE" ,
3640+ ".eslintrc.json" : JSON . stringify ( { root : true } ) ,
3641+ "index.js" : "console.log(\"hello\")"
3642+ }
3643+ } ) . CLIEngine ;
3644+ engine = new CLIEngine ( ) ;
3645+
3646+ // Don't throw "failed to load config file" error.
3647+ engine . executeOnFiles ( "." ) ;
3648+ } ) ;
3649+
3650+ it ( "'executeOnFiles(\".\")' should not ignore '.' even if 'ignorePatterns' contains it." , ( ) => {
3651+ CLIEngine = defineCLIEngineWithInMemoryFileSystem ( {
3652+ cwd : ( ) => root ,
3653+ files : {
3654+ "../.eslintrc.json" : JSON . stringify ( { ignorePatterns : [ "/dont-ignore-entry-dir" ] } ) ,
3655+ ".eslintrc.json" : JSON . stringify ( { root : true } ) ,
3656+ "index.js" : "console.log(\"hello\")"
3657+ }
3658+ } ) . CLIEngine ;
3659+ engine = new CLIEngine ( ) ;
3660+
3661+ // Don't throw "file not found" error.
3662+ engine . executeOnFiles ( "." ) ;
3663+ } ) ;
3664+
3665+ it ( "'executeOnFiles(\"subdir\")' should not ignore './subdir' even if 'ignorePatterns' contains it." , ( ) => {
3666+ CLIEngine = defineCLIEngineWithInMemoryFileSystem ( {
3667+ cwd : ( ) => root ,
3668+ files : {
3669+ ".eslintrc.json" : JSON . stringify ( { ignorePatterns : [ "/subdir" ] } ) ,
3670+ "subdir/.eslintrc.json" : JSON . stringify ( { root : true } ) ,
3671+ "subdir/index.js" : "console.log(\"hello\")"
3672+ }
3673+ } ) . CLIEngine ;
3674+ engine = new CLIEngine ( ) ;
3675+
3676+ // Don't throw "file not found" error.
3677+ engine . executeOnFiles ( "subdir" ) ;
3678+ } ) ;
3679+ } ) ;
36313680 } ) ;
36323681
36333682 describe ( "getConfigForFile" , ( ) => {
0 commit comments