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

Function strToError

packages/jest-core/src/TestScheduler.ts:505–512  ·  view source on GitHub ↗
(errString: string)

Source from the content-addressed store, hash-verified

503};
504
505const strToError = (errString: string): SerializableError => {
506 const {message, stack} = separateMessageFromStack(errString);
507 if (stack.length > 0) {
508 return {message, stack};
509 }
510 const error = new ErrorWithStack(message, buildExecError);
511 return {message, stack: error.stack || ''};
512};
513
514const buildExecError = (err: unknown): SerializableError => {
515 if (typeof err === 'string' || err == null) {

Callers 1

buildExecErrorFunction · 0.85

Calls 1

separateMessageFromStackFunction · 0.90

Tested by

no test coverage detected