Skip to content

Commit

Permalink
fix(core): update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless committed Sep 24, 2024
1 parent a21dcfd commit 6591d51
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -572,13 +572,15 @@ describe('Run Commands', () => {
...process.env,
...env(),
},
windowsHide: true,
});
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
maxBuffer: LARGE_BUFFER,
env: {
...process.env,
...env(),
},
windowsHide: true,
});
});

Expand All @@ -601,13 +603,15 @@ describe('Run Commands', () => {
...process.env,
...env(),
},
windowsHide: true,
});
expect(exec).toHaveBeenNthCalledWith(2, `echo 'Hello Universe'`, {
maxBuffer: LARGE_BUFFER,
env: {
...process.env,
...env(),
},
windowsHide: true,
});
});

Expand All @@ -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,
});
});
});
Expand Down
30 changes: 24 additions & 6 deletions packages/nx/src/utils/git-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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', () => {
Expand All @@ -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,
});
});
});

Expand Down

0 comments on commit 6591d51

Please sign in to comment.