mocha-chai-jest-snapshot
Version:
provides snapshot testing like jest
25 lines (24 loc) • 1.12 kB
TypeScript
import type { use as chaiUse } from "chai";
import { addSerializer, getSerializers } from "jest-snapshot";
import { Config } from "@jest/types";
import SnapshotManager from "./manager";
type FirstFunctionArgument<T> = T extends (arg: infer A) => unknown ? A : never;
type ChaiPlugin = FirstFunctionArgument<typeof chaiUse>;
export declare function _setReporterAttached(): void;
export declare function _getSnapshotManager(): SnapshotManager;
declare const jestSnapshotPlugin: (optionalConfig?: Partial<Config.ProjectConfig>) => ChaiPlugin;
declare const initSnapshotManager: ChaiPlugin;
export { initSnapshotManager, jestSnapshotPlugin, addSerializer, getSerializers, };
type SnapshotSerializerPlugin = import("pretty-format").Plugin;
declare global {
namespace Chai {
interface Assertion {
/** Assert that the object matches the snapshot */
toMatchSnapshot(message?: string): Assertion;
matchSnapshot(message?: string): Assertion;
}
interface ExpectStatic {
addSnapshotSerializer(serializer: SnapshotSerializerPlugin): void;
}
}
}