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

Function getOperatorName

packages/jest-circus/src/formatNodeAssertErrors.ts:77–88  ·  view source on GitHub ↗
(operator: string | undefined, stack: string)

Source from the content-addressed store, hash-verified

75};
76
77const getOperatorName = (operator: string | undefined, stack: string) => {
78 if (typeof operator === 'string') {
79 return assertOperatorsMap[operator] || operator;
80 }
81 if (stack.match('.doesNotThrow')) {
82 return 'doesNotThrow';
83 }
84 if (stack.match('.throws')) {
85 return 'throws';
86 }
87 return '';
88};
89
90const operatorMessage = (operator: string | undefined) => {
91 const niceOperatorName = getOperatorName(operator, '');

Callers 2

operatorMessageFunction · 0.70
assertionErrorMessageFunction · 0.70

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected