@japa/snapshot
Version:
Snapshot testing plugin for Japa
42 lines (41 loc) • 1.21 kB
TypeScript
import type { Test } from '@japa/runner/core';
import { SnapshotFile } from './snapshot_file.js';
import type { SnapshotPluginOptions } from './types.js';
export declare class FileSnapshotter {
#private;
constructor(options?: SnapshotPluginOptions);
/**
* Return all SnapshotFile instances
*/
getFiles(): Set<SnapshotFile>;
/**
* Check if a snapshot file exists for a given test path
* Otherwise, create a new one and return it
*/
getSnapshotFileForTest(test: Test): SnapshotFile;
/**
* Check if the test has already a saved snapshot
*/
hasSnapshot(test: Test): boolean;
/**
* Update the snapshot for a given test
*/
updateSnapshot(test: Test, value: any): Promise<void>;
/**
* Compare a snapshot for a given test
*/
compareSnapshot(test: Test, received: any): boolean;
/**
* Returns the data needed for a future assertion
*/
getSnapshotTestData(test: Test, received: any): {
snapshotName: string;
expected: string | undefined;
received: string;
pass: boolean;
};
/**
* Save all snapshot files to disk
*/
saveSnapshots(): Promise<void>;
}