MCPcopy Index your code
hub / github.com/ampproject/amphtml / stubAsyncErrorThrows

Function stubAsyncErrorThrows

testing/async-errors.js:21–33  ·  view source on GitHub ↗

* Initializes the stubs to prevent async errors from being thrown during tests.

()

Source from the content-addressed store, hash-verified

19 * Initializes the stubs to prevent async errors from being thrown during tests.
20 */
21function 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.

Callers 2

test-error.jsFile · 0.85
preventAsyncErrorThrowsFunction · 0.85

Calls 2

indexOfExpectedMessageFunction · 0.90
applyMethod · 0.80

Tested by

no test coverage detected