lukeed / uvu

uvu is an extremely fast and lightweight test runner for Node.js and the browser
MIT License
2.97k stars 100 forks source link

A test that exits early should fail #207

Closed rictic closed 2 years ago

rictic commented 2 years ago

Fixes https://github.com/lukeed/uvu/issues/206

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

rolandzwaga commented 2 years ago

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

rictic commented 2 years ago

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

codecov-commenter commented 2 years ago

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%) :arrow_up:
src/parse.js
src/diff.js 98.40% <0.00%> (+0.01%) :arrow_up:

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.