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

Function assertMatcherHint

packages/jest-circus/src/formatNodeAssertErrors.ts:107–131  ·  view source on GitHub ↗
(
  operator: string | undefined | null,
  operatorName: string,
  expected: unknown,
)

Source from the content-addressed store, hash-verified

105 : '';
106
107const assertMatcherHint = (
108 operator: string | undefined | null,
109 operatorName: string,
110 expected: unknown,
111) => {
112 let message = '';
113
114 if (operator === '==' && expected === true) {
115 message =
116 chalk.dim('assert') +
117 chalk.dim('(') +
118 chalk.red('received') +
119 chalk.dim(')');
120 } else if (operatorName) {
121 message =
122 chalk.dim('assert') +
123 chalk.dim(`.${operatorName}(`) +
124 chalk.red('received') +
125 chalk.dim(', ') +
126 chalk.green('expected') +
127 chalk.dim(')');
128 }
129
130 return message;
131};
132
133function assertionErrorMessage(
134 error: AssertionErrorWithStack,

Callers 1

assertionErrorMessageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected