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

Don't abort Node on unhandled rejections (#421) #423

Merged
merged 1 commit into from
Oct 3, 2020

Conversation

garybernhardt
Copy link
Contributor

Fixes #421. Tests pass.

@lovasoa
Copy link
Member

lovasoa commented Oct 3, 2020

Thank you! We should add a test for the new behavior too.

@lovasoa lovasoa merged commit cec3fc6 into sql-js:master Oct 3, 2020
@garybernhardt garybernhardt deleted the issue-421 branch October 12, 2020 20:44
@garybernhardt
Copy link
Contributor Author

I spent a few minutes trying to come up with a test, but I can't get the bug to happen in the tests. I copied an existing test file and replaced its test function with:

exports.test = function(sql, assert) {
  // Intentionally leak a rejected promise
  Promise.reject("failure")
};

but that doesn't cause a test failure on the commit before the fix (e1ff5dc). I also tried various tricks to try to wait, in case the process was exiting too fast, but it seems like test functions can't return promises.

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.

Loading sql.js in Node makes it terminate the process when unrelated promise rejections are unhandled
2 participants