jestjs/jest

[Feature]: Upstream jest-file-snapshot?

Open

#12.734 aperta il 25 apr 2022

Vedi su GitHub
 (13 commenti) (2 reazioni) (0 assegnatari)TypeScript (6653 fork)batch import
:rocket: Feature RequestHelp WantedPinned

Metriche repository

Star
 (45.361 star)
Metriche merge PR
 (Merge medio 11g 22h) (11 PR mergiate in 30 g)

Descrizione

🚀 Feature Proposal

https://www.npmjs.com/package/jest-file-snapshot

I tend to migrate my snapshots from inline to jest-file-snapshots in almost every project I write tests for (either once the snapshots become unreasonably sized for inline or there's too many).

Do others have feelings about whether this library might be worth thinking about migrating into Jest itself?

Motivation

It's not offensive for me to add:

import { toMatchFile } from 'jest-file-snapshot';
 
expect.extend({ toMatchFile });

Per each file to use the plugin/types, but it is friction. As is ensuring that the generated files do not trigger the watcher, if the matchers were upstreamed Jest can know to watchlist ignore them.

Example

N/A

Pitch

It's ~150 LOC, so probably not a big maintenance burden and does a good job of expanding the scope of how folks can use snapshots

/cc @satya164

Guida contributor