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

Function formatError

packages/jest-runner/src/testWorker.ts:46–62  ·  view source on GitHub ↗
(error: string | ErrorWithCode)

Source from the content-addressed store, hash-verified

44});
45
46const formatError = (error: string | ErrorWithCode): SerializableError => {
47 if (typeof error === 'string') {
48 const {message, stack} = separateMessageFromStack(error);
49 return {
50 message,
51 stack,
52 type: 'Error',
53 };
54 }
55
56 return {
57 code: error.code || undefined,
58 message: error.message,
59 stack: error.stack,
60 type: 'Error',
61 };
62};
63
64const resolvers = new Map<string, Resolver>();
65const getResolver = (config: Config.ProjectConfig) => {

Callers 1

workerFunction · 0.85

Calls 1

separateMessageFromStackFunction · 0.90

Tested by

no test coverage detected