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

Function indexOfExpectedMessage

testing/console-logging-setup.js:49–63  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

47 * @return {number} index or -1
48 */
49export function indexOfExpectedMessage(message) {
50 // Match equal strings.
51 const exact = expectedAsyncErrors.indexOf(message);
52 if (exact != -1) {
53 return exact;
54 }
55 // Match regex.
56 for (let i = 0; i < expectedAsyncErrors.length; i++) {
57 const expectedError = expectedAsyncErrors[i];
58 if (typeof expectedError != 'string' && expectedError.test(message)) {
59 return i;
60 }
61 }
62 return -1;
63}
64
65/**
66 * Prints a warning when a console error is detected during a test.

Callers 2

stubAsyncErrorThrowsFunction · 0.90
printWarningFunction · 0.85

Calls 1

testMethod · 0.45

Tested by

no test coverage detected