Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect, jest-snapshot: Change color from green for some args in matcher hints #8812

Merged
merged 2 commits into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- `[expect]` Improve report when negative CalledWith assertion fails ([#8755](https://github.com/facebook/jest/pull/8755))
- `[expect]` Improve report when positive CalledWith assertion fails ([#8771](https://github.com/facebook/jest/pull/8771))
- `[expect]` Display equal values for ReturnedWith similar to CalledWith ([#8791](https://github.com/facebook/jest/pull/8791))
- `[expect, jest-snapshot]` Change color from green for some args in matcher hints ([#8812](https://github.com/facebook/jest/pull/8812))
- `[jest-snapshot]` Highlight substring differences when matcher fails, part 3 ([#8569](https://github.com/facebook/jest/pull/8569))
- `[jest-core]` Improve report when snapshots are obsolete ([#8448](https://github.com/facebook/jest/pull/8665))
- `[jest-cli]` Improve chai support (with detailed output, to match jest exceptions) ([#8454](https://github.com/facebook/jest/pull/8454))
Expand Down
40 changes: 20 additions & 20 deletions packages/expect/src/__tests__/__snapshots__/matchers.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ exports[`.toBeCloseTo() {pass: false} expect(-Infinity)toBeCloseTo( -1.23) 1`] =
Expected: <green>-1.23</>
Received: <red>-Infinity</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: < <green>0.005</>
Received difference: <red>Infinity</>"
`;
Expand All @@ -486,7 +486,7 @@ exports[`.toBeCloseTo() {pass: false} expect(Infinity)toBeCloseTo( -Infinity) 1`
Expected: <green>-Infinity</>
Received: <red>Infinity</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: < <green>0.005</>
Received difference: <red>Infinity</>"
`;
Expand All @@ -497,7 +497,7 @@ exports[`.toBeCloseTo() {pass: false} expect(Infinity)toBeCloseTo( 1.23) 1`] = `
Expected: <green>1.23</>
Received: <red>Infinity</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: < <green>0.005</>
Received difference: <red>Infinity</>"
`;
Expand All @@ -522,7 +522,7 @@ exports[`.toBeCloseTo() {pass: true} expect(0)toBeCloseTo( 0.001) 1`] = `
Expected: not <green>0.001</>
Received: <red>0</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: not < <green>0.005</>
Received difference: <red>0.001</>"
`;
Expand All @@ -533,7 +533,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.225) 1`] = `
Expected: not <green>1.225</>
Received: <red>1.23</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: not < <green>0.005</>
Received difference: <red>0.004999999999999893</>"
`;
Expand All @@ -544,7 +544,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.226) 1`] = `
Expected: not <green>1.226</>
Received: <red>1.23</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: not < <green>0.005</>
Received difference: <red>0.0040000000000000036</>"
`;
Expand All @@ -555,7 +555,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.229) 1`] = `
Expected: not <green>1.229</>
Received: <red>1.23</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: not < <green>0.005</>
Received difference: <red>0.0009999999999998899</>"
`;
Expand All @@ -566,7 +566,7 @@ exports[`.toBeCloseTo() {pass: true} expect(1.23)toBeCloseTo( 1.234) 1`] = `
Expected: not <green>1.234</>
Received: <red>1.23</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: not < <green>0.005</>
Received difference: <red>0.0040000000000000036</>"
`;
Expand All @@ -579,34 +579,34 @@ Expected: not <green>Infinity</>
`;

exports[`.toBeCloseTo() accepts an optional precision argument: [0, 0.000004, 5] 1`] = `
"<dim>expect(</><red>received</><dim>).</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>
"<dim>expect(</><red>received</><dim>).</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </>precision<dim>)</>

Expected: not <green>0.000004</>
Received: <red>0</>

Expected precision: <green>5</>
Expected precision: 5
Expected difference: not < <green>0.000005</>
Received difference: <red>0.000004</>"
`;

exports[`.toBeCloseTo() accepts an optional precision argument: [0, 0.0001, 3] 1`] = `
"<dim>expect(</><red>received</><dim>).</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>
"<dim>expect(</><red>received</><dim>).</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </>precision<dim>)</>

Expected: not <green>0.0001</>
Received: <red>0</>

Expected precision: <green>3</>
Expected precision: 3
Expected difference: not < <green>0.0005</>
Received difference: <red>0.0001</>"
`;

exports[`.toBeCloseTo() accepts an optional precision argument: [0, 0.1, 0] 1`] = `
"<dim>expect(</><red>received</><dim>).</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>
"<dim>expect(</><red>received</><dim>).</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </>precision<dim>)</>

Expected: not <green>0.1</>
Received: <red>0</>

Expected precision: <green>0</>
Expected precision: 0
Expected difference: not < <green>0.5</>
Received difference: <red>0.1</>"
`;
Expand All @@ -617,7 +617,7 @@ exports[`.toBeCloseTo() throws: [0, 0.01] 1`] = `
Expected: <green>0.01</>
Received: <red>0</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: < <green>0.005</>
Received difference: <red>0.01</>"
`;
Expand All @@ -628,7 +628,7 @@ exports[`.toBeCloseTo() throws: [1, 1.23] 1`] = `
Expected: <green>1.23</>
Received: <red>1</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: < <green>0.005</>
Received difference: <red>0.22999999999999998</>"
`;
Expand All @@ -639,13 +639,13 @@ exports[`.toBeCloseTo() throws: [1.23, 1.2249999] 1`] = `
Expected: <green>1.2249999</>
Received: <red>1.23</>

Expected precision: <green>2</>
Expected precision: 2
Expected difference: < <green>0.005</>
Received difference: <red>0.005000099999999952</>"
`;

exports[`.toBeCloseTo() throws: Matcher error promise empty isNot false received 1`] = `
"<dim>expect(</><red>received</><dim>).</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>
"<dim>expect(</><red>received</><dim>).</>toBeCloseTo<dim>(</><green>expected</><dim>, </>precision<dim>)</>

<bold>Matcher error</>: <red>received</> value must be a number

Expand Down Expand Up @@ -680,7 +680,7 @@ Received has value: <red>Symbol(0.1)</>"
`;

exports[`.toBeCloseTo() throws: Matcher error promise resolves isNot false received 1`] = `
"<dim>expect(</><red>received</><dim>).</>resolves<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>
"<dim>expect(</><red>received</><dim>).</>resolves<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </>precision<dim>)</>

<bold>Matcher error</>: <red>received</> value must be a number

Expand All @@ -689,7 +689,7 @@ Received has value: <red>false</>"
`;

exports[`.toBeCloseTo() throws: Matcher error promise resolves isNot true expected 1`] = `
"<dim>expect(</><red>received</><dim>).</>resolves<dim>.</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </><green>precision</><dim>)</>
"<dim>expect(</><red>received</><dim>).</>resolves<dim>.</>not<dim>.</>toBeCloseTo<dim>(</><green>expected</><dim>, </>precision<dim>)</>

<bold>Matcher error</>: <green>expected</> value must be a number

Expand Down
Loading