diff --git a/packages/nx/src/command-line/nx-commands.spec.ts b/packages/nx/src/command-line/nx-commands.spec.ts new file mode 100644 index 0000000000000..d37b249e91a66 --- /dev/null +++ b/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', + }, + }) + ); + }); +}); diff --git a/packages/nx/src/command-line/nx-commands.ts b/packages/nx/src/command-line/nx-commands.ts index 2c20ceb1bed7a..92fb3257ab365 100644 --- a/packages/nx/src/command-line/nx-commands.ts +++ b/packages/nx/src/command-line/nx-commands.ts @@ -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( `