@japa/snapshot
Version:
Snapshot testing plugin for Japa
34 lines (33 loc) • 1.1 kB
TypeScript
import type { Test } from '@japa/runner/core';
export declare class InlineSnaphotter {
#private;
/**
* Update a snapshot by saving the new serialized value
* in memory.
*
* Will be persisted to disk when the tests are done.
*/
updateSnapshot(test: Test, value: string, matcher: 'expect' | 'assert'): void;
/**
* Check if the received value matches the expected snapshot
*/
compareSnapshot(test: Test, received: any, expected: string): boolean;
/**
* Returns the data needed for a future assertion
*/
getSnapshotTestData(test: Test, received: any, expected: string): {
snapshotName: string;
expected: string | undefined;
received: string;
pass: boolean;
inline: boolean;
};
/**
* Saves all the inline snapshots that were updated during the run.
* Reads the file contents, updates inline snapshots, then writes the
* changes back to the file
*
* This method should be called after all tests have finished running.
*/
saveSnapshots(): Promise<void>;
}