@@ -1389,20 +1389,23 @@ describe("ESLint", () => {
1389
1389
) ;
1390
1390
} ) ;
1391
1391
1392
- it ( "should fail to load a CommonJS TS config file that exports undefined with a helpful error message" , async ( ) => {
1392
+ it ( "should fail to load a CommonJS TS config file that exports undefined with a helpful warning message" , async ( ) => {
1393
+
1394
+ sinon . restore ( ) ;
1393
1395
1394
1396
const cwd = getFixturePath ( "ts-config-files" , "ts" ) ;
1397
+ const processStub = sinon . stub ( process , "emitWarning" ) ;
1395
1398
1396
1399
eslint = new ESLint ( {
1397
1400
cwd,
1398
1401
flags,
1399
1402
overrideConfigFile : "eslint.undefined.config.ts"
1400
1403
} ) ;
1401
1404
1402
- await assert . rejects (
1403
- eslint . lintText ( "foo" ) ,
1404
- { message : "Config (unnamed): Unexpected undefined config at user-defined index 0." }
1405
- ) ;
1405
+ await eslint . lintText ( "foo" ) ;
1406
+
1407
+ assert . strictEqual ( processStub . callCount , 1 , "calls `process.emitWarning()` once" ) ;
1408
+ assert . strictEqual ( processStub . getCall ( 0 ) . args [ 1 ] , "ESLintEmptyConfigWarning" ) ;
1406
1409
1407
1410
} ) ;
1408
1411
@@ -5975,20 +5978,24 @@ describe("ESLint", () => {
5975
5978
) ;
5976
5979
} ) ;
5977
5980
5978
- it ( "should fail to load a CommonJS TS config file that exports undefined with a helpful error message" , async ( ) => {
5981
+ it ( "should fail to load a CommonJS TS config file that exports undefined with a helpful warning message" , async ( ) => {
5982
+
5983
+ sinon . restore ( ) ;
5979
5984
5980
5985
const cwd = getFixturePath ( "ts-config-files" , "ts" ) ;
5986
+ const processStub = sinon . stub ( process , "emitWarning" ) ;
5981
5987
5982
5988
eslint = new ESLint ( {
5983
5989
cwd,
5984
5990
flags,
5985
5991
overrideConfigFile : "eslint.undefined.config.ts"
5986
5992
} ) ;
5987
5993
5988
- await assert . rejects (
5989
- eslint . lintFiles ( "foo.js" ) ,
5990
- { message : "Config (unnamed): Unexpected undefined config at user-defined index 0." }
5991
- ) ;
5994
+ await eslint . lintFiles ( "foo.js" ) ;
5995
+
5996
+ assert . strictEqual ( processStub . callCount , 1 , "calls `process.emitWarning()` once" ) ;
5997
+ assert . strictEqual ( processStub . getCall ( 0 ) . args [ 1 ] , "ESLintEmptyConfigWarning" ) ;
5998
+
5992
5999
5993
6000
} ) ;
5994
6001
0 commit comments