@japa/snapshot
Version:
Snapshot testing plugin for Japa
50 lines (49 loc) • 1.39 kB
TypeScript
import type { Test } from '@japa/runner/core';
import type { SnapshotPluginOptions } from './types.js';
export declare class SnapshotManager {
#private;
/**
* Keep track of the different snapshot results/updates
*/
summary: {
passed: number;
failed: number;
updated: number;
};
constructor(options?: SnapshotPluginOptions);
/**
* Check if the test has an inline snapshot
*/
hasSnapshotInFile(test: Test): boolean;
/**
* Update an inline snapshot
*/
updateInlineSnapshot(test: Test, value: any, matcher: 'expect' | 'assert'): void;
/**
* Update a snapshot in the file
*/
updateFileSnapshot(test: Test, value: any): void;
/**
* Returns the data needed for a future assertion
*/
getInlineSnapshotTestData(test: Test, received: any, expected: string): {
snapshotName: string;
expected: string | undefined;
received: string;
pass: boolean;
inline: boolean;
};
/**
* Returns the data needed for a future assertion
*/
getFileSnapshotTestData(test: Test, received: any): {
snapshotName: string;
expected: string | undefined;
received: string;
pass: boolean;
};
/**
* Save both inline and file snapshots to disk
*/
saveSnapshots(): Promise<[void, void]>;
}