Skip to content
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

A test that exits early should fail #207

Merged
merged 3 commits into from
Jul 3, 2022
Merged

Conversation

rictic
Copy link
Contributor

@rictic rictic commented May 2, 2022

Fixes #206

Also fixes the case where a test calls process.exit(0) itself, as that's essentially the same thing.

Fixes lukeed#206

Also fixes the case where a test calls process.exit(0) itself, as that's essentially the same thing.
@rolandzwaga
Copy link

I just ran into this issue as well, so regardless of the solution it would be nice to see this fixed.

@rictic
Copy link
Contributor Author

rictic commented May 10, 2022

The nice part about this solution is that it also catches the case where you call into a library and that library calls process.exit(0). That library might even be doing a reasonable thing, but we want the test to fail in that case because not all tests may have completed, let alone completed successfully.

This isn't in tension with a solution that prevents tests from being GC'd

Copy link
Owner

@lukeed lukeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! few minor things, thanks!

src/index.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
test/index.js Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2022

Codecov Report

Merging #207 (71476a1) into master (86725b4) will decrease coverage by 0.35%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #207      +/-   ##
==========================================
- Coverage   89.48%   89.13%   -0.36%     
==========================================
  Files           4        3       -1     
  Lines         333      313      -20     
==========================================
- Hits          298      279      -19     
+ Misses         35       34       -1     
Impacted Files Coverage Δ
src/index.js 77.06% <100.00%> (+1.81%) ⬆️
src/parse.js
src/diff.js 98.40% <0.00%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 86725b4...71476a1. Read the comment docs.

Copy link
Owner

@lukeed lukeed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lukeed lukeed merged commit 70b59e7 into lukeed:master Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A garbage collected async test causes uvu to silently exit with success
4 participants