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

Function assertMatcherHint

packages/jest-jasmine2/src/assertionErrorMessage.ts:65–89  ·  view source on GitHub ↗
(
  operator: string | null,
  operatorName: string,
  expected: unknown,
)

Source from the content-addressed store, hash-verified

63 : '';
64
65const assertMatcherHint = (
66 operator: string | null,
67 operatorName: string,
68 expected: unknown,
69) => {
70 let message = '';
71
72 if (operator === '==' && expected === true) {
73 message =
74 chalk.dim('assert') +
75 chalk.dim('(') +
76 chalk.red('received') +
77 chalk.dim(')');
78 } else if (operatorName) {
79 message =
80 chalk.dim('assert') +
81 chalk.dim(`.${operatorName}(`) +
82 chalk.red('received') +
83 chalk.dim(', ') +
84 chalk.green('expected') +
85 chalk.dim(')');
86 }
87
88 return message;
89};
90
91function assertionErrorMessage(
92 error: AssertionErrorWithStack,

Callers 1

assertionErrorMessageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected