Skip to content

Commit

Permalink
feat: allow extra cli flags to be passed to unit testing executor
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanWalker committed Feb 11, 2022
1 parent 82b4bf7 commit cf6a614
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/nx/src/executors/test/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@ export default async function testExecutor(options: TestBuilderSchema, context:
nsOptions.push('--force');
}

// additional args after -- should be passed through
const argSeparator = process.argv.findIndex((arg) => arg === '--');
let additionalArgs = [];
if (argSeparator >= 0) {
additionalArgs = process.argv.slice(argSeparator + 1);
// additional cli flags
// console.log('projectTargetCmdIndex:', projectTargetCmdIndex)
const additionalArgs = [];
if (process.argv.length > projectTargetCmdIndex + 1) {
const extraFlags = process.argv.slice(projectTargetCmdIndex + 1, process.argv.length);
for (const flag of extraFlags) {
if (!nsOptions.includes(flag) && !additionalArgs.includes(flag)) {
additionalArgs.push(flag);
}
}
// console.log('additionalArgs:', additionalArgs);
}

console.log('---');
Expand Down

0 comments on commit cf6a614

Please sign in to comment.