-
Notifications
You must be signed in to change notification settings - Fork 238
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
valid-expect-in-promise doesn't work with Promise.all #219
Comments
You don't wait for them though - when you do const somePromise = Promise.resolve();
somePromise.then(() => Promise.reject('oh no'));
Promise.all([somePromise]).then(() => {
console.log('this resolves');
});
// logs
// this resolves
// "Uncaught (in promise) oh no" |
🤦♂️ Good catch! But if I change things to consider the new promises, it still fails: New code: test('Resource loader: client usage', function () {
expect.assertions(2);
const quxLoader = ResourceLoader.create(['qux']);
let promiseResolve;
fetchResult = new Promise(resolve => promiseResolve = resolve);
const promise1 = quxLoader.load()
.then(([x]) => expect(x.test).toBeTruthy());
const promise2 = quxLoader.load()
.then(([x]) => expect(x.test).toBeTruthy());
promiseResolve({test: true});
return Promise.all([promise1, promise2]);
}); eslint report:
|
Yeah, that's a bug 🙂 Doesn't seem like the rule handles |
For now I've decided that actually Instead, |
🎉 This issue has been resolved in version 24.6.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This issue has been resolved in version 25.0.0-next.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I have a test case that relies on multiple promises being tested with
Promise.all
:This causes the following eslint errors:
It'd be great if the rule would recognize
Promise.all
and considered it valid.The text was updated successfully, but these errors were encountered: