-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
tests: review and fix ineffective error tests #26385
Comments
E.g. these are speculative (as the fact that they indeed throw is probably already tested elsewhere), but I would still like these to include a safeguard check: node/test/pseudo-tty/test-assert-colors.js Lines 5 to 21 in 453ed05
node/test/pseudo-tty/test-assert-no-color.js Lines 7 to 19 in 453ed05
|
node/test/sequential/test-module-loading.js Lines 192 to 212 in 453ed05
Speculative: node/test/es-module/test-esm-error-cache.js Lines 21 to 25 in 453ed05
|
I will prepare a gist of potential entries to review. |
@JungMinu Are you working for this? I am going to work for this. If you already do, I want to avoid conflict. |
@shisama go for it |
using
Strikethrough indicates the file I don't think it includes the problem. |
Hey @ChALkeR I can work on adding a few safeguard checks for these tests! |
Fix tests whether errors are thrown correctly because they are successful when error doesn't get thrown. PR-URL: #27333 Fixes: #26385 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
See #26078 (review) for context.
After that, I looked up if we already have similar ineffective tests in our codebase, and I think that I found at least one.
E.g. using
grep -r ' catch' test/ -A 2 | grep strictEqual
, this one popped up half through the list:node/test/parallel/test-stream-readable-async-iterators.js
Lines 355 to 361 in 453ed05
The code above doesn't test that the error is thrown (as it likely should), instead it tests that another error doesn't get thrown.
Note that there are a lot of false positives in the said grep (actually most matches are false positives), because e.g. this is perfectly fine:
node/test/parallel/test-vm-module-errors.js
Lines 266 to 272 in 453ed05
The text was updated successfully, but these errors were encountered: