Skip to content

Commit cf6a614

Browse files
committed
feat: allow extra cli flags to be passed to unit testing executor
1 parent 82b4bf7 commit cf6a614

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

packages/nx/src/executors/test/executor.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,17 @@ export default async function testExecutor(options: TestBuilderSchema, context:
8383
nsOptions.push('--force');
8484
}
8585

86-
// additional args after -- should be passed through
87-
const argSeparator = process.argv.findIndex((arg) => arg === '--');
88-
let additionalArgs = [];
89-
if (argSeparator >= 0) {
90-
additionalArgs = process.argv.slice(argSeparator + 1);
86+
// additional cli flags
87+
// console.log('projectTargetCmdIndex:', projectTargetCmdIndex)
88+
const additionalArgs = [];
89+
if (process.argv.length > projectTargetCmdIndex + 1) {
90+
const extraFlags = process.argv.slice(projectTargetCmdIndex + 1, process.argv.length);
91+
for (const flag of extraFlags) {
92+
if (!nsOptions.includes(flag) && !additionalArgs.includes(flag)) {
93+
additionalArgs.push(flag);
94+
}
95+
}
96+
// console.log('additionalArgs:', additionalArgs);
9197
}
9298

9399
console.log('---');

0 commit comments

Comments
 (0)