Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
toMatchSnapshot(ctx) {
if (!ctx || !ctx.test) {
throw new Error(
dedent(`missing \`ctx\` parameter for .toMatchSnapshot(),
did you forget to pass \`this\` expect().toMatchSnapshot(this)?`),
const { test } = ctx;
// would contain the full path to test file
const testFile = test.file;
const testTitle = makeTestTitle(test);
const result = toMatchSnapshot(this.actual, testFile, testTitle);
expect.assert(result.pass, !result.pass ? : '');
return this;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment