diff --git a/packages/nx/src/utils/git-utils.spec.ts b/packages/nx/src/utils/git-utils.spec.ts index af51f95e2813b..67bc43ad2b2fd 100644 --- a/packages/nx/src/utils/git-utils.spec.ts +++ b/packages/nx/src/utils/git-utils.spec.ts @@ -21,7 +21,7 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('origin-user/repo-name'); - expect(execSync).toHaveBeenCalledWith('git remote -v'); + expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); }); it('should return "github" if there are no remotes', () => { @@ -30,7 +30,7 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('github'); - expect(execSync).toHaveBeenCalledWith('git remote -v'); + expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); }); it('should return "github" if execSync throws an error', () => { @@ -41,7 +41,7 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('github'); - expect(execSync).toHaveBeenCalledWith('git remote -v'); + expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); }); it('should return the first github remote slug if no origin is present', () => { @@ -53,7 +53,7 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('upstream-user/repo-name'); - expect(execSync).toHaveBeenCalledWith('git remote -v'); + expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); }); it('should return null if remote is set up but not github', () => { @@ -65,7 +65,7 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBeNull(); - expect(execSync).toHaveBeenCalledWith('git remote -v'); + expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); }); it('should return the first github remote slug for HTTPS URLs', () => { @@ -77,7 +77,7 @@ describe('git utils tests', () => { const result = getGithubSlugOrNull(); expect(result).toBe('origin-user/repo-name'); - expect(execSync).toHaveBeenCalledWith('git remote -v'); + expect(execSync).toHaveBeenCalledWith('git remote -v', { stdio: 'pipe' }); }); }); diff --git a/packages/nx/src/utils/git-utils.ts b/packages/nx/src/utils/git-utils.ts index 6e76c56a428b6..9b2a2cc3e6196 100644 --- a/packages/nx/src/utils/git-utils.ts +++ b/packages/nx/src/utils/git-utils.ts @@ -3,7 +3,9 @@ import { logger } from '../devkit-exports'; export function getGithubSlugOrNull(): string | null { try { - const gitRemote = execSync('git remote -v').toString(); + const gitRemote = execSync('git remote -v', { + stdio: 'pipe', + }).toString(); // If there are no remotes, we default to github if (!gitRemote || gitRemote.length === 0) { return 'github';