Replies: 3 comments
-
I think this rule is ok if you are using .then() because this ensures that the test waits until the promise is resolved and does not move on to the next test before resolution, as this can cause all sorts of issues. However, I think it is even better to use async/await when working with promises in tests. That way you don't even need Example before: describe('A suite', function() {
it('A spec', function(done) {
asyncCall().then(onSuccess, done.fail);
});
}); Example after: describe('A suite', () => {
it('A spec', async () => {
const result = await asyncCall();
expect(...)...
});
}); If the promise is rejected, the test will automatically fail with an exception because you do not have a try-catch block. No need to re-throw explicitly using done.fail. |
Beta Was this translation helpful? Give feedback.
-
When working with observables, you have 2 options. You can either convert it to a promise and await, or you can use |
Beta Was this translation helpful? Give feedback.
-
I have opened PR for using jasmine plugin recommended settings. |
Beta Was this translation helpful? Give feedback.
-
We should prevent commiting fdescribe/fit.
Jasmine plugin: eslint-plugin-jasmine
Beta Was this translation helpful? Give feedback.
All reactions