From 36d5dff57b79699c2c77647aab8a73af5e6fd444 Mon Sep 17 00:00:00 2001 From: Mike <31090859+mike-fam@users.noreply.github.com> Date: Thu, 15 Dec 2022 09:28:40 +1000 Subject: [PATCH 1/3] fix(core): fix parallel cli argument not default to 3 when not specified ISSUES CLOSED: #13782 --- packages/nx/src/utils/command-line-utils.spec.ts | 16 +++++++++++++++- packages/nx/src/utils/command-line-utils.ts | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/utils/command-line-utils.spec.ts b/packages/nx/src/utils/command-line-utils.spec.ts index c68058a47f437..5ad6558dd52cf 100644 --- a/packages/nx/src/utils/command-line-utils.spec.ts +++ b/packages/nx/src/utils/command-line-utils.spec.ts @@ -238,7 +238,21 @@ describe('splitArgs', () => { expect(parallel).toEqual(5); }); - it('should default to 3', () => { + it('should default to 3 when not specified', () => { + const parallel = splitArgsIntoNxArgsAndOverrides( + { + $0: '', + __overrides_unparsed__: [], + }, + 'affected', + {} as any, + {} as any + ).nxArgs.parallel; + + expect(parallel).toEqual(3); + }); + + it('should default to 3 when used with no value specified', () => { const parallel = splitArgsIntoNxArgsAndOverrides( { $0: '', diff --git a/packages/nx/src/utils/command-line-utils.ts b/packages/nx/src/utils/command-line-utils.ts index 0794e5bd9ed65..e68efaea3e89f 100644 --- a/packages/nx/src/utils/command-line-utils.ts +++ b/packages/nx/src/utils/command-line-utils.ts @@ -170,7 +170,8 @@ export function splitArgsIntoNxArgsAndOverrides( } else if ( args['parallel'] === 'true' || args['parallel'] === true || - args['parallel'] === '' + args['parallel'] === '' || + args['parallel'] === undefined ) { nxArgs['parallel'] = Number( nxArgs['maxParallel'] || nxArgs['max-parallel'] || 3 From 2dd3c789f72a5a58bded16f623cd5268a30537bb Mon Sep 17 00:00:00 2001 From: Mike <31090859+mike-fam@users.noreply.github.com> Date: Thu, 15 Dec 2022 11:34:52 +1000 Subject: [PATCH 2/3] fix(core): update unit tests ISSUES CLOSED: #13782 --- packages/nx/src/utils/command-line-utils.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/nx/src/utils/command-line-utils.spec.ts b/packages/nx/src/utils/command-line-utils.spec.ts index 5ad6558dd52cf..067dd593d734b 100644 --- a/packages/nx/src/utils/command-line-utils.spec.ts +++ b/packages/nx/src/utils/command-line-utils.spec.ts @@ -20,6 +20,7 @@ describe('splitArgs', () => { base: 'sha1', head: 'sha2', skipNxCache: false, + parallel: 3 }); }); @@ -51,6 +52,7 @@ describe('splitArgs', () => { ).toEqual({ base: 'main', skipNxCache: false, + parallel: 3 }); }); @@ -68,6 +70,7 @@ describe('splitArgs', () => { ).toEqual({ base: 'develop', skipNxCache: false, + parallel: 3 }); }); @@ -85,6 +88,7 @@ describe('splitArgs', () => { ).toEqual({ base: 'main', skipNxCache: false, + parallel: 3 }); }); @@ -181,6 +185,7 @@ describe('splitArgs', () => { base: 'envVarSha1', head: 'envVarSha2', skipNxCache: false, + parallel: 3 }); expect( @@ -198,6 +203,7 @@ describe('splitArgs', () => { base: 'envVarSha1', head: 'directlyOnCommandSha1', skipNxCache: false, + parallel: 3 }); expect( @@ -215,6 +221,7 @@ describe('splitArgs', () => { base: 'directlyOnCommandSha2', head: 'envVarSha2', skipNxCache: false, + parallel: 3 }); // Reset process data From 7ea9f3c3c805cbddd1290e53340d10d289a62ab2 Mon Sep 17 00:00:00 2001 From: Mike <31090859+mike-fam@users.noreply.github.com> Date: Thu, 15 Dec 2022 11:37:19 +1000 Subject: [PATCH 3/3] fix(core): run nx format ISSUES CLOSED: #13782 ISSUES CLOSED: #13782 --- packages/nx/src/utils/command-line-utils.spec.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/nx/src/utils/command-line-utils.spec.ts b/packages/nx/src/utils/command-line-utils.spec.ts index 067dd593d734b..5c76051a86364 100644 --- a/packages/nx/src/utils/command-line-utils.spec.ts +++ b/packages/nx/src/utils/command-line-utils.spec.ts @@ -20,7 +20,7 @@ describe('splitArgs', () => { base: 'sha1', head: 'sha2', skipNxCache: false, - parallel: 3 + parallel: 3, }); }); @@ -52,7 +52,7 @@ describe('splitArgs', () => { ).toEqual({ base: 'main', skipNxCache: false, - parallel: 3 + parallel: 3, }); }); @@ -70,7 +70,7 @@ describe('splitArgs', () => { ).toEqual({ base: 'develop', skipNxCache: false, - parallel: 3 + parallel: 3, }); }); @@ -88,7 +88,7 @@ describe('splitArgs', () => { ).toEqual({ base: 'main', skipNxCache: false, - parallel: 3 + parallel: 3, }); }); @@ -185,7 +185,7 @@ describe('splitArgs', () => { base: 'envVarSha1', head: 'envVarSha2', skipNxCache: false, - parallel: 3 + parallel: 3, }); expect( @@ -203,7 +203,7 @@ describe('splitArgs', () => { base: 'envVarSha1', head: 'directlyOnCommandSha1', skipNxCache: false, - parallel: 3 + parallel: 3, }); expect( @@ -221,7 +221,7 @@ describe('splitArgs', () => { base: 'directlyOnCommandSha2', head: 'envVarSha2', skipNxCache: false, - parallel: 3 + parallel: 3, }); // Reset process data