From 6591d51210a8729ed65bff8f0e757938a275a70a Mon Sep 17 00:00:00 2001 From: Max Kless Date: Tue, 24 Sep 2024 13:47:28 +0200 Subject: [PATCH] fix(core): update tests --- .../run-commands/run-commands.impl.spec.ts | 6 ++++ packages/nx/src/utils/git-utils.spec.ts | 30 +++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/packages/nx/src/executors/run-commands/run-commands.impl.spec.ts b/packages/nx/src/executors/run-commands/run-commands.impl.spec.ts index 95bfb5ab4d198..a5e5715455515 100644 --- a/packages/nx/src/executors/run-commands/run-commands.impl.spec.ts +++ b/packages/nx/src/executors/run-commands/run-commands.impl.spec.ts @@ -572,6 +572,7 @@ describe('Run Commands', () => { ...process.env, ...env(), }, + windowsHide: true, }); expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, { maxBuffer: LARGE_BUFFER, @@ -579,6 +580,7 @@ describe('Run Commands', () => { ...process.env, ...env(), }, + windowsHide: true, }); }); @@ -601,6 +603,7 @@ describe('Run Commands', () => { ...process.env, ...env(), }, + windowsHide: true, }); expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, { maxBuffer: LARGE_BUFFER, @@ -608,6 +611,7 @@ describe('Run Commands', () => { ...process.env, ...env(), }, + windowsHide: true, }); }); @@ -627,10 +631,12 @@ describe('Run Commands', () => { expect(exec).toHaveBeenNthCalledWith(1, `echo 'Hello World'`, { maxBuffer: LARGE_BUFFER, env: { ...process.env, FORCE_COLOR: `true`, ...env() }, + windowsHide: true, }); expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, { maxBuffer: LARGE_BUFFER, env: { ...process.env, FORCE_COLOR: `true`, ...env() }, + windowsHide: true, }); }); }); diff --git a/packages/nx/src/utils/git-utils.spec.ts b/packages/nx/src/utils/git-utils.spec.ts index 67bc43ad2b2fd..3ff74484e292e 100644 --- a/packages/nx/src/utils/git-utils.spec.ts +++ b/packages/nx/src/utils/git-utils.spec.ts @@ -21,7 +21,10 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('origin-user/repo-name'); - expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); + expect(execSync).toHaveBeenCalledWith('git remote -v', { + stdio: 'pipe', + windowsHide: true, + }); }); it('should return "github" if there are no remotes', () => { @@ -30,7 +33,10 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('github'); - expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); + expect(execSync).toHaveBeenCalledWith('git remote -v', { + stdio: 'pipe', + windowsHide: true, + }); }); it('should return "github" if execSync throws an error', () => { @@ -41,7 +47,10 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('github'); - expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); + expect(execSync).toHaveBeenCalledWith('git remote -v', { + stdio: 'pipe', + windowsHide: true, + }); }); it('should return the first github remote slug if no origin is present', () => { @@ -53,7 +62,10 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('upstream-user/repo-name'); - expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); + expect(execSync).toHaveBeenCalledWith('git remote -v', { + stdio: 'pipe', + windowsHide: true, + }); }); it('should return null if remote is set up but not github', () => { @@ -65,7 +77,10 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBeNull(); - expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); + expect(execSync).toHaveBeenCalledWith('git remote -v', { + stdio: 'pipe', + windowsHide: true, + }); }); it('should return the first github remote slug for HTTPS URLs', () => { @@ -77,7 +92,10 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('origin-user/repo-name'); - expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); + expect(execSync).toHaveBeenCalledWith('git remote -v', { + stdio: 'pipe', + windowsHide: true, + }); }); });