Skip to content

Commit

Permalink
expect, jest-snapshot: Change color from green for some args in match…
Browse files Browse the repository at this point in the history
…er hints (#8812)

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

* Update CHANGELOG.md
  • Loading branch information
pedrottimark authored Aug 12, 2019
1 parent 86e73f5 commit 9406708
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 131 deletions.
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

0 comments on commit 9406708

Please sign in to comment.