-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
make watch plugin initialization errors look nice #8422
Conversation
be3dac5
to
d674117
Compare
const e = new Error(
`Failed to initialize watch plugin '${
pluginWithConfig.path
}':\n\n${formatExecError(err, contexts[0].config, {
noStackTrace: false,
})}`,
);
// or `delete` it
e.stack = '';
return Promise.reject(e); Does that work? I like the "Test suite failed to run" text, just getting rid of the outer stack trace should make it nice and clean 🙂 |
|
Ah, the good old absolute path on CI. Well, I'll take care of that tomorrow... |
packages/jest-core/src/__tests__/__snapshots__/watch.test.js.snap
Outdated
Show resolved
Hide resolved
packages/jest-core/src/watch.ts
Outdated
@@ -183,7 +183,7 @@ export default function watch( | |||
} catch (error) { | |||
const errorWithContext = new Error( | |||
`Failed to initialize watch plugin "${chalk.bold( | |||
path.posix.relative(process.cwd(), pluginWithConfig.path), | |||
path.relative(process.cwd(), pluginWithConfig.path), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pass it through slash
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try that 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is unhappy, but this lgtm. Really nice!
ca06354
to
ce869df
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Follow up to jest-community/jest-watch-typeahead#29
Any idea how we could get rid of the outer stack trace and / or "Test suite failed to run"? In the current state it IMO looks worse than just the plain error. @SimenB
Edit: fixed outer stack trace, updated screenshot
Test plan
Added snapshot test.
Manual test -> see screenshot