MCPcopy
hub / github.com/jestjs/jest / addSuppressedErrors

Function addSuppressedErrors

packages/jest-jasmine2/src/setup_jest_globals.ts:32–49  ·  view source on GitHub ↗
(result: SpecResult)

Source from the content-addressed store, hash-verified

30// test execution and add them to the test result, potentially failing
31// a passing test.
32const addSuppressedErrors = (result: SpecResult) => {
33 const {suppressedErrors} = jestExpect.getState();
34 jestExpect.setState({suppressedErrors: []});
35 if (suppressedErrors.length > 0) {
36 result.status = 'failed';
37
38 result.failedExpectations = suppressedErrors.map(error => ({
39 actual: '',
40 // passing error for custom test reporters
41 error,
42 expected: '',
43 matcherName: '',
44 message: error.message,
45 passed: false,
46 stack: error.stack,
47 }));
48 }
49};
50
51const addAssertionErrors = (result: SpecResult) => {
52 const assertionErrors = jestExpect.extractExpectedAssertionsErrors();

Callers 1

constructorMethod · 0.85

Calls 2

getStateMethod · 0.80
setStateMethod · 0.65

Tested by

no test coverage detected