-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snapshot testing #346
Comments
What should the format be? Jest uses a CommonJS-inspired format, so here’s a few suggestions: // test code
test(function doThingA() {
assertMatchesSnaphot(foo)
})
test({
name: 'do thing B',
fn() {
assertMatchesSnaphot(foo)
}
})
// option 1
import 'https://deno.land/std/testing/snapshot/v1.ts'
export default {
doThingA: [`blah blah`],
'do thing B': [`blah blah`]
}
// option 2
import 'https://deno.land/std/testing/snapshot/v1.ts'
export const doThingA = [`blah blah`]
export const do__thing__B = [`blah blah`] |
@j-f1 look at jest |
Jest uses this format: // Jest Snapshot v1, https://goo.gl/fbAQLP
[ if the snapshot is single-line ]
exports[`test name here 1`] = `foo`
[ if the snapshot is multiline ]
exports[`test name here 2`] = `
foo
bar
` My two snapshot proposals alter this in a few ways:
|
Here’s another proposal: eschew the JS format altogether Deno snapshot v1, https://deno.land/std/testing/snapshot/v1.md
snapshot `test name here` [`
foo
`, `
foo
bar
`]
snapshot `another test` [`foo`, `foo bar`] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add
.toMatchSnapshot()
matcher to testing moduleThe text was updated successfully, but these errors were encountered: