chai-jest-snapshot icon indicating copy to clipboard operation
chai-jest-snapshot copied to clipboard

Property matcher support

Open ethanresnick opened this issue 5 years ago • 2 comments

I understand that this code probably isn't ready to merge yet (e.g., it doesn't have tests or docs), but I wanted to at least open this PR in case others find it helpful.

Basically, it enables Jest 23 with property matchers, which make snapshot testing much more broadly applicable. The property matchers always go as the first argument (including when you're updating a snapshot with to.matchSnaphot(matchers, true)), and their values must come from the expect module that jest uses under the hood. I.e.,

import { any } from "expect";

// ...
expect(it).to.matchSnapshot({ id: any(String) })

ethanresnick avatar Sep 20 '18 21:09 ethanresnick

This PR works great and would be super cool to merge! /cc @suchipi :pray:

naz avatar Dec 08 '21 17:12 naz

Can we get this merged? Also the same for update jest-snapshot dependency.

piranna avatar Apr 24 '23 10:04 piranna