Skip to content

Commit

Permalink
fix(core): allow parsing dot notation cli args (#9812)
Browse files Browse the repository at this point in the history
parse dot notation cli args for env args passed to cypress executor to override cypress.env.json
values.
i.e. nx e2e project --env.API_URL=localhost:1234
will now correctly give cypress e2e args to
override the cypress.env.json values

ISSUES CLOSED: #9764
  • Loading branch information
barbados-clemens authored and FrozenPandaz committed Apr 19, 2022
1 parent 5811e85 commit 2b045e0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 24 additions & 0 deletions packages/nx/src/command-line/nx-commands.spec.ts
@@ -0,0 +1,24 @@
import { commandsObject } from 'nx/src/command-line/nx-commands';

describe('nx-commands', () => {
it('should parse dot notion cli args', () => {
const actual = commandsObject.parse(
'nx e2e project-e2e --env.NX_API_URL=http://localhost:4200 --abc.123.xyx=false --a.b=3'
);
expect(actual).toEqual(
expect.objectContaining({
abc: {
'123': {
xyx: 'false',
},
},
a: {
b: 3,
},
env: {
NX_API_URL: 'http://localhost:4200',
},
})
);
});
});
3 changes: 2 additions & 1 deletion packages/nx/src/command-line/nx-commands.ts
Expand Up @@ -25,7 +25,8 @@ yargs.wrap(yargs.terminalWidth());
export const commandsObject = yargs
.parserConfiguration({
'strip-dashed': true,
'dot-notation': false,
// allow parsing --env.SOME_ARG for cypress cli env args
'dot-notation': true,
})
.usage(
`
Expand Down

0 comments on commit 2b045e0

Please sign in to comment.