@@ -407,6 +407,7 @@ describe('namespace-scoped options', () => {
407407 '--expose-internals' ,
408408 '--experimental-config-file' ,
409409 fixtures . path ( 'rc/namespaced/node.config.json' ) ,
410+ '--no-test' ,
410411 '-p' , 'require("internal/options").getOptionValue("--test-isolation")' ,
411412 ] ) ;
412413 assert . strictEqual ( result . stderr , '' ) ;
@@ -483,6 +484,7 @@ describe('namespace-scoped options', () => {
483484 '--test-isolation' , 'process' ,
484485 '--experimental-config-file' ,
485486 fixtures . path ( 'rc/namespaced/node.config.json' ) ,
487+ '--no-test' ,
486488 '-p' , 'require("internal/options").getOptionValue("--test-isolation")' ,
487489 ] ) ;
488490 assert . strictEqual ( result . stderr , '' ) ;
@@ -498,6 +500,7 @@ describe('namespace-scoped options', () => {
498500 '--test-coverage-exclude' , 'cli-pattern2' ,
499501 '--experimental-config-file' ,
500502 fixtures . path ( 'rc/namespace-with-array.json' ) ,
503+ '--no-test' ,
501504 '-p' , 'JSON.stringify(require("internal/options").getOptionValue("--test-coverage-exclude"))' ,
502505 ] ) ;
503506 assert . strictEqual ( result . stderr , '' ) ;
@@ -520,6 +523,7 @@ describe('namespace-scoped options', () => {
520523 '--expose-internals' ,
521524 '--experimental-config-file' ,
522525 fixtures . path ( 'rc/namespace-with-disallowed-envvar.json' ) ,
526+ '--no-test' ,
523527 '-p' , 'require("internal/options").getOptionValue("--test-concurrency")' ,
524528 ] ) ;
525529 assert . strictEqual ( result . stderr , '' ) ;
@@ -536,6 +540,7 @@ describe('namespace-scoped options', () => {
536540 '--test-concurrency' , '2' ,
537541 '--experimental-config-file' ,
538542 fixtures . path ( 'rc/namespace-with-disallowed-envvar.json' ) ,
543+ '--no-test' ,
539544 '-p' , 'require("internal/options").getOptionValue("--test-concurrency")' ,
540545 ] ) ;
541546 assert . strictEqual ( result . stderr , '' ) ;
@@ -554,4 +559,41 @@ describe('namespace-scoped options', () => {
554559 assert . strictEqual ( result . stdout , '' ) ;
555560 assert . strictEqual ( result . code , 9 ) ;
556561 } ) ;
562+
563+ it ( 'should automatically enable --test flag when test namespace is present' , async ( ) => {
564+ const result = await spawnPromisified ( process . execPath , [
565+ '--no-warnings' ,
566+ '--experimental-config-file' ,
567+ fixtures . path ( 'rc/namespaced/node.config.json' ) ,
568+ fixtures . path ( 'rc/test.js' ) ,
569+ ] ) ;
570+ assert . strictEqual ( result . code , 0 ) ;
571+ assert . match ( result . stdout , / t e s t s 1 / ) ;
572+ } ) ;
573+
574+ it ( 'should automatically enable --permission flag when permission namespace is present' , async ( ) => {
575+ const result = await spawnPromisified ( process . execPath , [
576+ '--no-warnings' ,
577+ '--expose-internals' ,
578+ '--experimental-config-file' ,
579+ fixtures . path ( 'rc/permission-namespace.json' ) ,
580+ '-p' , 'require("internal/options").getOptionValue("--permission")' ,
581+ ] ) ;
582+ assert . strictEqual ( result . stderr , '' ) ;
583+ assert . strictEqual ( result . stdout , 'true\n' ) ;
584+ assert . strictEqual ( result . code , 0 ) ;
585+ } ) ;
586+
587+ it ( 'should respect explicit test: false in test namespace' , async ( ) => {
588+ const result = await spawnPromisified ( process . execPath , [
589+ '--no-warnings' ,
590+ '--expose-internals' ,
591+ '--experimental-config-file' ,
592+ fixtures . path ( 'rc/test-namespace-explicit-false.json' ) ,
593+ '-p' , 'require("internal/options").getOptionValue("--test")' ,
594+ ] ) ;
595+ assert . strictEqual ( result . stderr , '' ) ;
596+ assert . strictEqual ( result . stdout , 'false\n' ) ;
597+ assert . strictEqual ( result . code , 0 ) ;
598+ } ) ;
557599} ) ;
0 commit comments