method

test.MatchersBuiltin.toMatchFileSnapshot

path: string,
hint?: string
): Promise<void>;

Asserts that a value matches the contents of its own snapshot file. A string is compared as is. Any other value is first printed the way a snapshot prints it.

If the file doesn't exist, it's created, except in CI. --update-snapshots rewrites a file that differs.

@param path

The file's path, relative to the test file.

@param hint

Hint used to number the snapshot among the test's other snapshots.

await expect(render(page)).toMatchFileSnapshot("./snapshots/page.html");