-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Report on unhandled promises #80
Comments
You are actually already using this, which funnily enough breaks the tests that I'm trying to write for loud-rejection 😆 Ava is built with Man was it annoying to track down as well, const org = process.on;
process.on = function () {
console.trace(arguments);
org.apply(this, arguments);
}
const fn = require('./');
const test = require('ava');
fn();
function fire() {
return new Promise(function (resolve, reject) {
setImmediate(function () {
const org = console.error
console.error = function () {
console.error = org
console.trace(arguments) // <------ Finally manage to find it with this
}
reject(new Error('unicorn'));
});
});
} |
Another fun fact, calling
|
Oh, damn... Although, in the next version of AVA we're spawing each test file in it's own process, so we'll have to explicitly include it then. Try using AVA master as dependency for now. Example: https://github.com/sindresorhus/got/blob/f4cf6c7b44d047d505ed1fdf3a4e361b743bdfc2/package.json#L64 |
Hmm, for some reason using master stopped my |
Also, I can't get |
I think I got everything working, except for the |
Closed via: c5d02f1 |
Promises are silent by default and it's easy to forget handling a promise somewhere down the chain or forget to return the promise in the test. Using
loud-rejection
, we can throw in those cases so the user know they did something wrong.Need to wait on sindresorhus/loud-rejection#1.
Note to self: Document this in the readme too.
The text was updated successfully, but these errors were encountered: