-
Notifications
You must be signed in to change notification settings - Fork 1.4k
await t.throws is not waiting #391
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
Comments
It's actually hard, or maybe impossible, to write a failing test for this as it might be So here is a small code snippet import test from 'ava';
function delay() {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('foo'));
}, 500);
});
}
test('await', async t => {
const start = Date.now();
await t.throws(delay, 'foo');
t.true(Date.now() - start > 500);
}); which results in
|
Probably related to #360. You no longer need to |
That indeed solves the issue in my first post. Refactored the tests and now they are working correctly. My second post actually looks like another issue. Closing this one and will create a new issue. Have to investigate first. |
The code snippet of my second post is wrong, that's why it wasn't working. It had to be |
Hi
The latest tests of the delay module are not working as you can see in this travis report.
I investigated it and I noticed some weird stuff was going on with the
x.throws
method.I added an extra log in the
setTimeout
method of the delay module. This is the output:Does anyone has an idea how this is possible? I will try to add a failing test with the
delay
module.The text was updated successfully, but these errors were encountered: