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
Assert that async expect
s are awaited or returned
#54
Comments
I'm going to give this one a try today. |
A question about test('some test', async () => {
expect(await Promise.resolve('hello')).resolves.toBe('hello');
}); |
Nope, correct there is no |
I closed #78 - this is open for someone to give another shot at resolving this issue. 👍 |
This would be a great feature, would have saved me a lot of mistakes today. It would be nice if it could also be configurable, to enforce one or the other syntax: // return
test('some test', () =>
expect(Promise.resolve('hello')).resolves.toBe('hello');
);
// async/await
test('some test', async () => {
await expect(Promise.resolve('hello')).resolves.toBe('hello');
}); Personally I would want to configure it to allow only |
I agree it would be best if we could enforce |
🎉 This issue has been resolved in version 22.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
valid-expect
should check that if there's arejects
orresolves
on anexpect
, that it's eitherawait
ed orreturn
ed.Example where we should warn:
The text was updated successfully, but these errors were encountered: