-
Notifications
You must be signed in to change notification settings - Fork 108
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
node 15, eventually.throw ? #267
Comments
This behavior change is due to a documented breaking change in Node 15:
So you can see that the code will still work with Node 15 or 16 if you call it with:
You can also workaround it by adding this to your tests, realizing that you are modifying the global environment:
A global solution to add this to your tests is to create a "bootstrap" file that is loaded before all your tests run and add the code there. But this may cause your code to issue warning when under test but then throw in production. 🤷🏼
|
Another option is to quit using The pattern is to attach a return Promise.reject(new Error()).then(() => assert.fail(), () => {}); That's using a two-argument call to return Promise.resolve().then(() => assert.fail(), () => {}); This is approach I'm going with. Promises are already complex enough so removing the extra complexity added by the global side-effects of |
This construct works in Node 10,12,14 and breaks in Node 15
Real test case:
https://github.com/sifive/duh-core/blob/master/test/invalid.js#L26
Node 12 (worked before)
https://github.com/sifive/duh-core/runs/1301279599?check_suite_focus=true#step:4:49
Node 15 (does not work as expected)
https://github.com/sifive/duh-core/runs/1301279658?check_suite_focus=true#step:4:60
The text was updated successfully, but these errors were encountered: