@@ -10,6 +10,7 @@ const {
10
10
ArrayPrototypeJoin,
11
11
ArrayPrototypeMap,
12
12
ArrayPrototypePush,
13
+ ArrayPrototypePushApply,
13
14
ArrayPrototypeShift,
14
15
ArrayPrototypeSlice,
15
16
ArrayPrototypeSome,
@@ -130,7 +131,13 @@ function filterExecArgv(arg, i, arr) {
130
131
! ArrayPrototypeSome ( kFilterArgValues , ( p ) => arg === p || ( i > 0 && arr [ i - 1 ] === p ) || StringPrototypeStartsWith ( arg , `${ p } =` ) ) ;
131
132
}
132
133
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 } ) {
134
141
const argv = ArrayPrototypeFilter ( process . execArgv , filterExecArgv ) ;
135
142
if ( forceExit === true ) {
136
143
ArrayPrototypePush ( argv , '--test-force-exit' ) ;
@@ -148,12 +155,16 @@ function getRunArgs(path, { forceExit, inspectPort, testNamePatterns, testSkipPa
148
155
ArrayPrototypePush ( argv , '--test-only' ) ;
149
156
}
150
157
158
+ ArrayPrototypePushApply ( argv , execArgv ) ;
159
+
151
160
if ( path === kIsolatedProcessName ) {
152
161
ArrayPrototypePush ( argv , '--test' , ...ArrayPrototypeSlice ( process . argv , 1 ) ) ;
153
162
} else {
154
163
ArrayPrototypePush ( argv , path ) ;
155
164
}
156
165
166
+ ArrayPrototypePushApply ( argv , suppliedArgs ) ;
167
+
157
168
return argv ;
158
169
}
159
170
@@ -548,6 +559,8 @@ function run(options = kEmptyObject) {
548
559
lineCoverage = 0 ,
549
560
branchCoverage = 0 ,
550
561
functionCoverage = 0 ,
562
+ execArgv = [ ] ,
563
+ argv = [ ] ,
551
564
} = options ;
552
565
553
566
if ( files != null ) {
@@ -643,6 +656,9 @@ function run(options = kEmptyObject) {
643
656
validateInteger ( branchCoverage , 'options.branchCoverage' , 0 , 100 ) ;
644
657
validateInteger ( functionCoverage , 'options.functionCoverage' , 0 , 100 ) ;
645
658
659
+ validateStringArray ( argv , 'options.argv' ) ;
660
+ validateStringArray ( execArgv , 'options.execArgv' ) ;
661
+
646
662
const rootTestOptions = { __proto__ : null , concurrency, timeout, signal } ;
647
663
const globalOptions = {
648
664
__proto__ : null ,
@@ -685,6 +701,8 @@ function run(options = kEmptyObject) {
685
701
forceExit,
686
702
cwd,
687
703
isolation,
704
+ argv,
705
+ execArgv,
688
706
} ;
689
707
690
708
if ( isolation === 'process' ) {
0 commit comments