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

Function removeLinesBeforeExternalMatcherTrap

packages/jest-snapshot/src/utils.ts:42–54  ·  view source on GitHub ↗
(stack: string)

Source from the content-addressed store, hash-verified

40 : string;
41
42export const removeLinesBeforeExternalMatcherTrap = (stack: string): string => {
43 const lines = stack.split('\n');
44
45 for (let i = 0; i < lines.length; i += 1) {
46 // It's a function name specified in `packages/expect/src/index.ts`
47 // for external custom matchers.
48 if (lines[i].includes('__EXTERNAL_MATCHER_TRAP__')) {
49 return lines.slice(i + 1).join('\n');
50 }
51 }
52
53 return stack;
54};
55
56const escapeRegex = true;
57const printFunctionName = false;

Callers 2

_addSnapshotMethod · 0.90
utils.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected