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

Function getThrown

packages/expect/src/toThrowMatchers.ts:57–76  ·  view source on GitHub ↗
(e: any)

Source from the content-addressed store, hash-verified

55 };
56
57const getThrown = (e: any): Thrown => {
58 const hasMessage =
59 e !== null && e !== undefined && typeof e.message === 'string';
60
61 if (hasMessage && typeof e.name === 'string' && typeof e.stack === 'string') {
62 return {
63 hasMessage,
64 isError: true,
65 message: e.message,
66 value: e,
67 };
68 }
69
70 return {
71 hasMessage,
72 isError: false,
73 message: hasMessage ? e.message : String(e),
74 value: e,
75 };
76};
77
78export const createMatcher = (
79 matcherName: string,

Callers 1

createMatcherFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected