Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Fix error message for sl (steam locomotive)
When running jest in watch mode, with `sl` installed
(https://github.com/mtoyoda/sl), it errors out with the following
message:

```
  ● Test suite failed to run

thrown: [Error]
```

This is bad because the error is extremely hard to debug.

This change makes it error as follows:

```
  ● Test suite failed to run

    Command failed with ENAMETOOLONG: sl status -amnu /Users/rmartine/dev/ias-backstage/packages/backend
    spawn ENAMETOOLONG
```

This, at least, points people in the right direction.

See also: #14046
  • Loading branch information
rmartine-ias committed May 3, 2024
commit 7edc18d986fd8c9cfda473e9937e4c1a0fc39a11
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