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

Function toThrowErrorMatchingInlineSnapshot

packages/jest-snapshot/src/index.ts:443–475  ·  view source on GitHub ↗
(received, inlineSnapshot, fromPromise)

Source from the content-addressed store, hash-verified

441 Context,
442 [inlineSnapshot?: string, fromPromise?: boolean]
443> = function (received, inlineSnapshot, fromPromise) {
444 const matcherName = 'toThrowErrorMatchingInlineSnapshot';
445
446 if (inlineSnapshot !== undefined && typeof inlineSnapshot !== 'string') {
447 const options: MatcherHintOptions = {
448 expectedColor: noColor,
449 isNot: this.isNot,
450 promise: this.promise,
451 };
452
453 throw new Error(
454 matcherErrorMessage(
455 matcherHint(matcherName, undefined, SNAPSHOT_ARG, options),
456 'Inline snapshot must be a string',
457 printWithType('Inline snapshot', inlineSnapshot, serialize),
458 ),
459 );
460 }
461
462 return _toThrowErrorMatchingSnapshot(
463 {
464 context: this,
465 inlineSnapshot:
466 inlineSnapshot === undefined
467 ? undefined
468 : stripAddedIndentation(inlineSnapshot),
469 isInline: true,
470 matcherName,
471 received,
472 },
473 fromPromise,
474 );
475};
476
477const _toThrowErrorMatchingSnapshot = (
478 config: MatchSnapshotConfig,

Callers

nothing calls this directly

Calls 5

matcherErrorMessageFunction · 0.90
matcherHintFunction · 0.90
printWithTypeFunction · 0.90
stripAddedIndentationFunction · 0.85

Tested by

no test coverage detected