jest-extended
jest-extended copied to clipboard
Handle `.not` cases in toThrowWithMessage
What
During the initial implementation of toThrowWithMessage I forgot to handle the .not during validation. As such, when a user uses .not, validation doesn't work at all.
Why
The matcher won't correctly validate .not cases.
Notes
Housekeeping
- [x] Unit tests
- [x] Documentation is up to date
- [x] No additional lint warnings
- [x] Add yourself to contributors list (
yarn contributor) - [x] Typescript definitions are added/updated where relevant
Codecov Report
Merging #173 into master will not change coverage. The diff coverage is
100%.
@@ Coverage Diff @@
## master #173 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 109 109
Lines 554 555 +1
Branches 97 98 +1
=====================================
+ Hits 554 555 +1
| Impacted Files | Coverage Ξ | |
|---|---|---|
| src/matchers/toThrowWithMessage/index.js | 100% <100%> (ΓΈ) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Ξ = absolute <relative> (impact),ΓΈ = not affected,? = missing dataPowered by Codecov. Last update c9cc718...fef3e82. Read the comment docs.
Hey @mattphillips, can we get this merged in? My current implementation only handled the happy case. :)
Sorry about the huge delay... Could you rebase this? π
I merged in some of main, but I'm not 100% how to resolve the conflict. Sorry!
I'll take a look at this next week no sweat :)
I added this test and it seemed to pass. Is this still an issue.
test('my test', () => {
expect(() => {
throw new TypeError('Expected message');
}).not.toThrowWithMessage.call(
{ utils: { matcherHint: matcherHint, printExpected: printExpected, printReceived: printReceived } },
SyntaxError,
'Expected message',
);
});