jestjs/jest

[Feature]: Upstream jest-file-snapshot?

Ouverte

#12 734 ouverte le 25 avr. 2022

 (13 commentaires) (2 réactions) (0 personne assignée)TypeScript (6 653 forks)batch import
:rocket: Feature RequestHelp WantedPinned

Métriques du dépôt

Stars
 (45 361 étoiles)
Métriques de merge PR
 (Merge moyen 11j 22h) (11 PRs mergées en 30 j)

Description

🚀 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

Guide contributeur