* Initializes the stubs to prevent async errors from being thrown during tests.
()
| 19 | * Initializes the stubs to prevent async errors from being thrown during tests. |
| 20 | */ |
| 21 | function stubAsyncErrorThrows() { |
| 22 | rethrowAsyncSandbox = sinon.createSandbox(); |
| 23 | rethrowAsyncSandbox.stub(coreError, 'rethrowAsync').callsFake((...args) => { |
| 24 | const error = coreError.createError.apply(null, args); |
| 25 | const index = indexOfExpectedMessage(error.message); |
| 26 | if (index != -1) { |
| 27 | expectedAsyncErrors.splice(index, 1); |
| 28 | return; |
| 29 | } |
| 30 | self.__AMP_REPORT_ERROR(error); |
| 31 | throw error; |
| 32 | }); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Resets async error behavior to its default. |
no test coverage detected