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

Function ensureNoExpected

packages/jest-matcher-utils/src/index.ts:155–173  ·  view source on GitHub ↗
(
  expected: unknown,
  matcherName: string,
  options?: MatcherHintOptions,
)

Source from the content-addressed store, hash-verified

153}
154
155export const ensureNoExpected = (
156 expected: unknown,
157 matcherName: string,
158 options?: MatcherHintOptions,
159): void => {
160 if (expected !== undefined) {
161 // Prepend maybe not only for backward compatibility.
162 const matcherString = (options ? '' : '[.not]') + matcherName;
163 throw new Error(
164 matcherErrorMessage(
165 matcherHint(matcherString, undefined, '', options),
166 // Because expected is omitted in hint above,
167 // expected is black instead of green in message below.
168 'this matcher must not have an expected argument',
169 printWithType('Expected', expected, printExpected),
170 ),
171 );
172 }
173};
174
175/**
176 * Ensures that `actual` is of type `number | bigint`

Callers 9

toBeDefinedFunction · 0.90
toBeFalsyFunction · 0.90
toBeNaNFunction · 0.90
toBeNullFunction · 0.90
toBeTruthyFunction · 0.90
toBeUndefinedFunction · 0.90
index.test.tsFile · 0.85

Calls 3

matcherErrorMessageFunction · 0.85
matcherHintFunction · 0.85
printWithTypeFunction · 0.85

Tested by

no test coverage detected