Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message for sl (steam locomotive) #15052

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

- `[babel-plugin-jest-hoist]` Use `denylist` instead of the deprecated `blacklist` for Babel 8 support ([#14109](https://github.com/jestjs/jest/pull/14109))
- `[expect]` Check error instance type for `toThrow/toThrowError` ([#14576](https://github.com/jestjs/jest/pull/14576))
- `[jest-changed-files]` Print underlying errors when VCS commands fail ([#15052](https://github.com/jestjs/jest/pull/15052))
- `[jest-circus]` [**BREAKING**] Prevent false test failures caused by promise rejections handled asynchronously ([#14315](https://github.com/jestjs/jest/pull/14315))
- `[jest-circus]` Replace recursive `makeTestResults` implementation with iterative one ([#14760](https://github.com/jestjs/jest/pull/14760))
- `[jest-circus]` Omit `expect.hasAssertions()` errors if a test already has errors ([#14866](https://github.com/jestjs/jest/pull/14866))
Expand Down
15 changes: 1 addition & 14 deletions packages/jest-changed-files/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,14 @@
*/

import * as path from 'path';
import {types} from 'util';
import execa = require('execa');
import type {SCMAdapter} from './types';

const findChangedFilesUsingCommand = async (
args: Array<string>,
cwd: string,
): Promise<Array<string>> => {
let result: execa.ExecaReturnValue;

try {
result = await execa('git', args, {cwd});
} catch (error) {
if (types.isNativeError(error)) {
const err = error as execa.ExecaError;
// TODO: Should we keep the original `message`?
err.message = err.stderr;
}

throw error;
}
const result = await execa('git', args, {cwd});

return result.stdout
.split('\n')
Expand Down
15 changes: 1 addition & 14 deletions packages/jest-changed-files/src/hg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import * as path from 'path';
import {types} from 'util';
import execa = require('execa');
import type {SCMAdapter} from './types';

Expand All @@ -30,19 +29,7 @@ const adapter: SCMAdapter = {
}
args.push(...includePaths);

let result: execa.ExecaReturnValue;

try {
result = await execa('hg', args, {cwd, env});
} catch (error) {
if (types.isNativeError(error)) {
const err = error as execa.ExecaError;
// TODO: Should we keep the original `message`?
err.message = err.stderr;
}

throw error;
}
const result = await execa('hg', args, {cwd, env});

return result.stdout
.split('\n')
Expand Down
15 changes: 1 addition & 14 deletions packages/jest-changed-files/src/sl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

import * as path from 'path';
import {types} from 'util';
import execa = require('execa');
import type {SCMAdapter} from './types';

Expand All @@ -34,19 +33,7 @@ const adapter: SCMAdapter = {
}
args.push(...includePaths);

let result: execa.ExecaReturnValue;

try {
result = await execa('sl', args, {cwd, env});
} catch (error) {
if (types.isNativeError(error)) {
const err = error as execa.ExecaError;
// TODO: Should we keep the original `message`?
err.message = err.stderr;
}

throw error;
}
const result = await execa('sl', args, {cwd, env});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make the same change for all the VCS checks? trying to silence the error doesn't really seem useful in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the change, added changelog entry!


return result.stdout
.split('\n')
Expand Down
Loading