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

Function testDiffContextLines

packages/jest-diff/src/__tests__/diff.test.ts:706–731  ·  view source on GitHub ↗
(contextLines?: number)

Source from the content-addressed store, hash-verified

704
705describe('context', () => {
706 const testDiffContextLines = (contextLines?: number) => {
707 const validContextLines =
708 typeof contextLines === 'number' &&
709 Number.isSafeInteger(contextLines) &&
710 contextLines >= 0;
711
712 test(`number of lines: ${
713 typeof contextLines === 'number' ? contextLines : 'undefined'
714 } ${validContextLines ? '' : '(5 default)'}`, () => {
715 const options = {
716 ...optionsCounts,
717 contextLines,
718 expand: false,
719 };
720 if (!validContextLines) {
721 options.patchColor = chalk.dim;
722 }
723
724 const result = diff(
725 {test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]},
726 {test: [1, 2, 3, 4, 5, 6, 7, 8, 10, 9]},
727 options,
728 );
729 expect(result).toMatchSnapshot();
730 });
731 };
732
733 testDiffContextLines(-1); // (5 default)
734 testDiffContextLines(0);

Callers 1

diff.test.tsFile · 0.85

Calls 4

expectFunction · 0.85
toMatchSnapshotMethod · 0.80
testFunction · 0.50
diffFunction · 0.50

Tested by

no test coverage detected