@@ -358,11 +358,25 @@ test('should use node.config.json when --experimental-config-file has no argumen
358358 assert . strictEqual ( result . code , 0 ) ;
359359 } ) ;
360360
361+ test ( 'should use node.config.json when -f has no argument' ,
362+ onlyIfNodeOptionsSupport , async ( ) => {
363+ const result = await spawnPromisified ( process . execPath , [
364+ '--no-warnings' ,
365+ '-f' ,
366+ '-p' , 'http.maxHeaderSize' ,
367+ ] , {
368+ cwd : fixtures . path ( 'rc/default' ) ,
369+ } ) ;
370+ assert . strictEqual ( result . stderr , '' ) ;
371+ assert . strictEqual ( result . stdout , '10\n' ) ;
372+ assert . strictEqual ( result . code , 0 ) ;
373+ } ) ;
374+
361375test ( 'should not treat the script path as a config file argument' ,
362376 onlyIfNodeOptionsSupport , async ( ) => {
363377 const result = await spawnPromisified ( process . execPath , [
364378 '--no-warnings' ,
365- '--experimental-config-file ' ,
379+ '-f ' ,
366380 fixtures . path ( 'printA.js' ) ,
367381 ] , {
368382 cwd : fixtures . path ( 'rc/default' ) ,
@@ -390,6 +404,18 @@ test('should treat a space-separated config file path as the script',
390404 assert . strictEqual ( result . code , 1 ) ;
391405 } ) ;
392406
407+ test ( 'should work with -f=path' ,
408+ onlyIfNodeOptionsSupport , async ( ) => {
409+ const result = await spawnPromisified ( process . execPath , [
410+ '--no-warnings' ,
411+ `-f=${ fixtures . path ( 'rc/default/node.config.json' ) } ` ,
412+ '-p' , 'http.maxHeaderSize' ,
413+ ] ) ;
414+ assert . strictEqual ( result . stderr , '' ) ;
415+ assert . strictEqual ( result . stdout , '10\n' ) ;
416+ assert . strictEqual ( result . code , 0 ) ;
417+ } ) ;
418+
393419test ( 'should error when --experimental-config-file= has empty argument' ,
394420 onlyIfNodeOptionsSupport , async ( ) => {
395421 const result = await spawnPromisified ( process . execPath , [
@@ -403,6 +429,19 @@ test('should error when --experimental-config-file= has empty argument',
403429 assert . strictEqual ( result . code , 9 ) ;
404430 } ) ;
405431
432+ test ( 'should error when -f= has empty argument' ,
433+ onlyIfNodeOptionsSupport , async ( ) => {
434+ const result = await spawnPromisified ( process . execPath , [
435+ '--no-warnings' ,
436+ '-f=' ,
437+ '-p' , 'http.maxHeaderSize' ,
438+ ] , {
439+ cwd : fixtures . path ( 'rc/default' ) ,
440+ } ) ;
441+ assert . match ( result . stderr , / - - e x p e r i m e n t a l - c o n f i g - f i l e = r e q u i r e s a n a r g u m e n t / ) ;
442+ assert . strictEqual ( result . code , 9 ) ;
443+ } ) ;
444+
406445test ( 'should error when --experimental-default-config-file has an explicit argument' ,
407446 onlyIfNodeOptionsSupport , async ( ) => {
408447 const result = await spawnPromisified ( process . execPath , [
0 commit comments