MCPcopy Index your code
hub / github.com/nodejs/node / getRunArgs

Function getRunArgs

lib/internal/test_runner/runner.js:181–259  ·  view source on GitHub ↗
(path, { forceExit,
                            inspectPort,
                            testNamePatterns,
                            testSkipPatterns,
                            testTagFilterExpressions,
                            only,
                            hasFiles,
                            testFiles,
                            globPatterns,
                            argv: suppliedArgs,
                            execArgv,
                            rerunFailuresFilePath,
                            randomize,
                            randomSeed,
                            root: { timeout },
                            cwd })

Source from the content-addressed store, hash-verified

179}
180
181function getRunArgs(path, { forceExit,
182 inspectPort,
183 testNamePatterns,
184 testSkipPatterns,
185 testTagFilterExpressions,
186 only,
187 hasFiles,
188 testFiles,
189 globPatterns,
190 argv: suppliedArgs,
191 execArgv,
192 rerunFailuresFilePath,
193 randomize,
194 randomSeed,
195 root: { timeout },
196 cwd }) {
197 const processNodeOptions = getOptionsAsFlagsFromBinding();
198 const runArgs = ArrayPrototypeFilter(processNodeOptions, filterExecArgv);
199
200 /**
201 * Node supports V8 options passed via cli.
202 * These options are being consumed by V8 and are not stored in nodeOptions.
203 *
204 * We need to propagate these options to the child processes manually.
205 *
206 * An example of such option are --allow-natives-syntax and --expose-gc
207 */
208 const nodeOptionsSet = new SafeSet(processNodeOptions);
209 const unknownProcessExecArgv = ArrayPrototypeFilter(
210 process.execArgv,
211 (arg) => !nodeOptionsSet.has(arg),
212 );
213 ArrayPrototypePushApply(runArgs, unknownProcessExecArgv);
214
215 if (forceExit === true) {
216 ArrayPrototypePush(runArgs, '--test-force-exit');
217 }
218 if (isUsingInspector()) {
219 ArrayPrototypePush(runArgs, `--inspect-port=${getInspectPort(inspectPort)}`);
220 }
221 if (testNamePatterns != null) {
222 ArrayPrototypeForEach(testNamePatterns, (pattern) => ArrayPrototypePush(runArgs, `--test-name-pattern=${pattern}`));
223 }
224 if (testSkipPatterns != null) {
225 ArrayPrototypeForEach(testSkipPatterns, (pattern) => ArrayPrototypePush(runArgs, `--test-skip-pattern=${pattern}`));
226 }
227 if (testTagFilterExpressions != null) {
228 ArrayPrototypeForEach(testTagFilterExpressions, (value) => ArrayPrototypePush(runArgs, `--experimental-test-tag-filter=${value}`));
229 }
230 if (only === true) {
231 ArrayPrototypePush(runArgs, '--test-only');
232 }
233 if (timeout != null) {
234 ArrayPrototypePush(runArgs, `--test-timeout=${timeout}`);
235 }
236 if (rerunFailuresFilePath) {
237 ArrayPrototypePush(runArgs, `--test-rerun-failures=${rerunFailuresFilePath}`);
238 }

Callers 1

runTestFileFunction · 0.85

Calls 4

isUsingInspectorFunction · 0.85
getInspectPortFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…