This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expect.extend({ | |
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 ? result.report() : ''); | |
return this; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment