mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
125 stars 41 forks source link

Catch and throw errors in sagas while testing #10859

Closed kumar303 closed 6 years ago

kumar303 commented 6 years ago

We use a pattern like this to test sagas:

sagaTester.dispatch(initialAction());

const lastExpectedAction = someAction();
await sagaTester.waitFor(lastExpectedAction.type);

If the saga encounters an exception, you will see something like this in the console:

console.warn src/amo/sagas/your-saga.js:76
  [Some information about the exception]

Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.

It would be great if the exception were just thrown so you wouldn't have to wait for the timeout and dig through the console to find the warning.

willdurand commented 6 years ago

I think this issue is a duplicate of mozilla/addons#2027, which has more information.