-
Notifications
You must be signed in to change notification settings - Fork 41
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
exitCode always 0 when encountering stale approvals #125
Comments
davidalpert
added a commit
to davidalpert/Approvals.NodeJS
that referenced
this issue
Oct 13, 2021
hacktoberfest-ready 🎃 😁 |
@davidalpert I think I'd like to understand more about why you are not getting the proper exit code. I ran a test locally and cannot seem to reproduce.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When
errorOnStaleApprovedFiles
is set to true, and the code finds stale approvals, it exits in a way that leaves the process exit code at0
.node
mocha
approvals
It took me the longest time to figure out why my
mocha
unit tests were always returning0
even when tests failed. Eventually I considered interaction betweenmocha
and other libraries and it occurred to me to investigate how theapprovals
library may interact withexitCode
.This led me quickly to issue #7 and commit 6e8e859 which introduced this
Approvals.NodeJS/lib/Approvals.js
Lines 70 to 72 in 6e8e859
It turns out that
mocha
also uses theprocess.on('exit', function(..) { ... })
pattern to setprocess.exitCode
, so when this approvals postRunCleanup handler squats on the sameexit
event and throws, the process seems to exit withoutmocha
's handler properly setting the exit code.This is significant because we expect builds to fail when tests fail. I also expect builds to fail when stale approvals are found if the flag is set such that we are running this check.
The text was updated successfully, but these errors were encountered: