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

Function getOperatorName

packages/jest-jasmine2/src/assertionErrorMessage.ts:35–46  ·  view source on GitHub ↗
(operator: string | null, stack: string)

Source from the content-addressed store, hash-verified

33};
34
35const getOperatorName = (operator: string | null, stack: string) => {
36 if (typeof operator === 'string') {
37 return assertOperatorsMap[operator] || operator;
38 }
39 if (stack.match('.doesNotThrow')) {
40 return 'doesNotThrow';
41 }
42 if (stack.match('.throws')) {
43 return 'throws';
44 }
45 return '';
46};
47
48const operatorMessage = (operator: string | null) => {
49 const niceOperatorName = getOperatorName(operator, '');

Callers 2

operatorMessageFunction · 0.70
assertionErrorMessageFunction · 0.70

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected