-
-
Notifications
You must be signed in to change notification settings - Fork 133
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(jest task): Return error when tests fail #1053
fix(jest task): Return error when tests fail #1053
Conversation
Callback always resolved successfully even when test failed Incorrect data was accessed in result data to determine failure Closes aurelia#1052
b42c7ce
to
bfbe072
Compare
lib/resources/tasks/jest.js
Outdated
cb(new PluginError('gulp-jest', { message: 'Tests Failed' })); | ||
jest.runCLI(options, [path.resolve(__dirname, '../../')]).then(({ results }) => { | ||
if (results.numFailedTests || results.numFailedTestSuites) { | ||
cb(new PluginError('jest-cli', { message: 'Tests Failed' })); |
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.
It looks like (existing code) new PluginError
generated excessive output in the console. To my limited understanding of gulp, it seems this is not a place for PluginError because it's not within context of a plugin.
Following gulpjs's example, cb(new Error('Tests Failed'));
is enough and probably the correct way. @JeroenVinke can you have a look?
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 have hardly any experience with Gulp so left it in place, I agree the output seems excessive but it resolved the issue which was more important in my case. I will replace it with an error in my local setup and test to see if it also forces a build failure (I assume it does). If it needs to be replaced please let me know and I will update the PR.
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.
BTW, it looks jest is only feature in cli that uses plugin-error as a dep. If we decide to get rid of PluginError here, we can cleanup the dependencies.json
and unit-test-runners/jest.js
too.
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.
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.
Today I also noticed just returning a string in the callback is enough to make it show an error.
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.
Today I also noticed just returning a string in the callback is enough to make it show an error.
That's even better! Let's just clean up everything.
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.
@huochunpeng Updated and removed plugin-error package.
Remove plugin error, returning a message is enough to make the process emit an error.
@EisenbergEffect this can be merged. |
Callback always resolved successfully even when test failed
Incorrect data was accessed in result data to determine failure
Closes #1052