Improve description line when assertion fails: part 1#5437
Improve description line when assertion fails: part 1#5437cpojer merged 4 commits intojestjs:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5437 +/- ##
==========================================
- Coverage 62.18% 62.17% -0.01%
==========================================
Files 205 205
Lines 6928 6927 -1
Branches 3 4 +1
==========================================
- Hits 4308 4307 -1
Misses 2619 2619
Partials 1 1
Continue to review full report at Codecov.
|
|
|
||
| exports[`.toBeCloseTo() throws: [1.23, 1.2249999] 1`] = ` | ||
| "<dim>expect(</><red>received</><dim>).toBeCloseTo(</><green>expected, precision</><dim>)</> | ||
| "<dim>expect(</><red>received</><dim>).toBeCloseTo(</><green>expected</><dim>)</> |
There was a problem hiding this comment.
One of toBeCloseTo snapshots should have a precision param set.
There was a problem hiding this comment.
Yes, see 3 tests for accepts an optional precision argument like needles in the haystack just above this last set of 3 for throws however I will make a note to self that there do not seem to be any tests that assertion throws error if either arg is not number.
| comment?: string, | ||
| isDirectExpectCall?: boolean, | ||
| secondArgument?: ?string, | ||
| }, |
There was a problem hiding this comment.
Can we set this to have a default value of = {} to avoid further options && checks?
|
I actually like it this way! |
|
Good stuff indeed! |
|
Love it, great attention to detail here @pedrottimark! |
|
By the way, part 2 will include one CHANGELOG item for both, if you will excuse me on this one ;) |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
First in series of pull requests for clearer shorter report when assertion fails.
To warm up, let’s sweat some small stuff :) //cc @thymikee @rickhanlonii
Apply two principles from The Non-Designer’s Design Book by Robin Williams:
toHavePropertyassertion.toBeCloseTowhich concatenated names instead of providing secondary as option.// Object.is equalityto be parallel with// strict equalityand// deep equalityin next PR] at end of line instead labels in labelExpected value to be (using Object.is)of values, which a future pull request will omit when there is a diff.Test plan
toHavePropertyassertion.