jestjs/jest

[Feature]: Upstream jest-file-snapshot?

開放

#12,734 建立於 2022年4月25日

 (13 則留言) (2 個反應) (0 位負責人)TypeScript (6,653 個分叉)batch import
:rocket: Feature RequestHelp WantedPinned

倉庫指標

星標
 (45,361 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

🚀 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

貢獻者指南