@@ -10,6 +10,7 @@ const {
1010 ArrayPrototypeJoin,
1111 ArrayPrototypeMap,
1212 ArrayPrototypePush,
13+ ArrayPrototypePushApply,
1314 ArrayPrototypeShift,
1415 ArrayPrototypeSlice,
1516 ArrayPrototypeSome,
@@ -130,7 +131,13 @@ function filterExecArgv(arg, i, arr) {
130131 ! ArrayPrototypeSome ( kFilterArgValues , ( p ) => arg === p || ( i > 0 && arr [ i - 1 ] === p ) || StringPrototypeStartsWith ( arg , `${ p } =` ) ) ;
131132}
132133
133- function getRunArgs ( path , { forceExit, inspectPort, testNamePatterns, testSkipPatterns, only } ) {
134+ function getRunArgs ( path , { forceExit,
135+ inspectPort,
136+ testNamePatterns,
137+ testSkipPatterns,
138+ only,
139+ argv : suppliedArgs ,
140+ execArgv } ) {
134141 const argv = ArrayPrototypeFilter ( process . execArgv , filterExecArgv ) ;
135142 if ( forceExit === true ) {
136143 ArrayPrototypePush ( argv , '--test-force-exit' ) ;
@@ -148,12 +155,16 @@ function getRunArgs(path, { forceExit, inspectPort, testNamePatterns, testSkipPa
148155 ArrayPrototypePush ( argv , '--test-only' ) ;
149156 }
150157
158+ ArrayPrototypePushApply ( argv , execArgv ) ;
159+
151160 if ( path === kIsolatedProcessName ) {
152161 ArrayPrototypePush ( argv , '--test' , ...ArrayPrototypeSlice ( process . argv , 1 ) ) ;
153162 } else {
154163 ArrayPrototypePush ( argv , path ) ;
155164 }
156165
166+ ArrayPrototypePushApply ( argv , suppliedArgs ) ;
167+
157168 return argv ;
158169}
159170
@@ -548,6 +559,8 @@ function run(options = kEmptyObject) {
548559 lineCoverage = 0 ,
549560 branchCoverage = 0 ,
550561 functionCoverage = 0 ,
562+ execArgv = [ ] ,
563+ argv = [ ] ,
551564 } = options ;
552565
553566 if ( files != null ) {
@@ -643,6 +656,9 @@ function run(options = kEmptyObject) {
643656 validateInteger ( branchCoverage , 'options.branchCoverage' , 0 , 100 ) ;
644657 validateInteger ( functionCoverage , 'options.functionCoverage' , 0 , 100 ) ;
645658
659+ validateStringArray ( argv , 'options.argv' ) ;
660+ validateStringArray ( execArgv , 'options.execArgv' ) ;
661+
646662 const rootTestOptions = { __proto__ : null , concurrency, timeout, signal } ;
647663 const globalOptions = {
648664 __proto__ : null ,
@@ -685,6 +701,8 @@ function run(options = kEmptyObject) {
685701 forceExit,
686702 cwd,
687703 isolation,
704+ argv,
705+ execArgv,
688706 } ;
689707
690708 if ( isolation === 'process' ) {
0 commit comments