-
Notifications
You must be signed in to change notification settings - Fork 248
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(report): waiting promise resolve in onExist method fix #418 #419
Conversation
3d5372e
to
9bc1103
Compare
…er#418 onComplete are async method which should bw complete in onExit method
if (results && results.exitCode === 1) { | ||
done(results.exitCode) | ||
return | ||
} | ||
if (typeof config._onExit === 'function') { | ||
config._onExit(done) |
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.
Not sure where this function gets defined or where it's used, but it won't be called in case exitCode is 1.
See #420 for my approach, which still calls it.
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.
Are you sure that will be useful to call callback onExit? custom code can call with 1 or 0 too but you are ignore it.
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.
Build will be failed. Is matter to execute onExit method?
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 don't know where _onExit
is defined or used, but with this change it's not called anymore in case the exitCode
is 1
. That's what I wanted to note here.
} | ||
|
||
this.onExit = async function (done) { | ||
const results = await promiseComplete |
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 is no error handling by karma in case promiseComplete
rejects. Karma doesn't expect the onExit
handlers to return a promise. I would suggest using plain old then
to handle success/error. See my code in #420
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.
await works with success only, if will be error the code onExit will be 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.
onExit
is called sync by the karma-runner and expects the callback to be invoked. It doesn't expect a promise to be returned. That's why I suspect that a rejection would result into an unhandled Promise rejection.
🎉 This PR is included in version 2.0.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
onComplete are async method which should bw complete in onExit method