Closed
Description
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Jest inline shapshots are like file-based snapshots but much more casual. I love using them for small snapshots and I think they'd be a great improvement to Deno. From Jest's docs, they look like:
it('renders correctly', () => {
const tree = renderer
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
expect(tree).toMatchInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
The Deno version might look like:
Deno.test("renders correctly", async () => {
const tree = renderer
.create(<Link page="https://example.com">Example Site</Link>)
.toJSON();
await assertInlineSnapshot(`
<a
className="normal"
href="https://example.com"
onMouseEnter={[Function]}
onMouseLeave={[Function]}
>
Example Site
</a>
`);
});
Describe alternatives you've considered
Right now, I just stick to the file-based snapshots which works fine but I find the locality of the inline snapshots much quicker to iterate on and they feel lightweight. I tend to avoid manual assertions more than a property or two as they're cumbersome to update.
Metadata
Metadata
Assignees
Labels
No labels