Commit 2afc2e87 authored by David Sveningsson's avatar David Sveningsson
Browse files

fix(jest): fix `TypeError: diff is not a function`

parent 714aabd2
Pipeline #311529456 passed with stages
in 10 minutes and 57 seconds
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/ban-ts-comment, prefer-template, sonarjs/no-duplicate-string */
import * as jestDiff from "jest-diff";
import jestDiffDefault, * as jestDiff from "jest-diff";
import deepmerge from "deepmerge";
import { TokenType } from "./lexer";
import { Message, Report, Result } from "./reporter";
......@@ -14,7 +14,8 @@ interface TokenMatcher {
/* istanbul ignore next: covered by compatibility tests but not a single pass */
const diff = jestDiff?.diff ?? jestDiff;
/* @ts-ignore typing for compatibility so it will seem "impossible" but different version will yield different source */
const diff: typeof jestDiff.diff = jestDiffDefault ?? jestDiff?.diff ?? jestDiff;
declare global {
namespace jest {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment