From 9cb1a5c568af567af053d6a9c4be853d480328a8 Mon Sep 17 00:00:00 2001 From: Aymeric Bouzy Date: Mon, 12 Mar 2018 22:17:32 +0100 Subject: [PATCH] Changelog and documentation for PR #5503 (Custom asymmetric matchers) (#5784) * test * define asymmetric matchers * more * correction * trying to fix flow * flow fix * Changelog * add example in documentation --- CHANGELOG.md | 2 ++ docs/ExpectAPI.md | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9f59f45e805..a5fe04d618ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ ([#5670](https://github.com/facebook/jest/pull/5670)) * `[expect]` Add inverse matchers (`expect.not.arrayContaining`, etc., [#5517](https://github.com/facebook/jest/pull/5517)) +* `[expect]` `expect.extend` now also extends asymmetric matchers + ([#5503](https://github.com/facebook/jest/pull/5503)) * `[jest-mock]` Update `spyOnProperty` to support spying on the prototype chain ([#5753](https://github.com/facebook/jest/pull/5753)) * `[jest-mock]` Add tracking of return values in the `mock` property diff --git a/docs/ExpectAPI.md b/docs/ExpectAPI.md index 784575aaab3e..2549488517bd 100644 --- a/docs/ExpectAPI.md +++ b/docs/ExpectAPI.md @@ -68,6 +68,10 @@ expect.extend({ test('even and odd numbers', () => { expect(100).toBeDivisibleBy(2); expect(101).not.toBeDivisibleBy(2); + expect({apples: 6, bananas: 3}).toEqual({ + apples: expect.toBeDivisibleBy(2), + bananas: expect.not.toBeDivisibleBy(2), + }); }); ```