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

Handle .not cases in toThrowWithMessage #173

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

natealcedo
Copy link
Contributor

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

  • Unit tests
  • Documentation is up to date
  • No additional lint warnings
  • Add yourself to contributors list (yarn contributor)
  • Typescript definitions are added/updated where relevant

@codecov-io
Copy link

Codecov Report

Merging #173 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          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%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9cc718...fef3e82. Read the comment docs.

@natealcedo
Copy link
Contributor Author

Hey @mattphillips, can we get this merged in? My current implementation only handled the happy case. :)

@SimenB
Copy link
Member

SimenB commented Oct 11, 2021

Sorry about the huge delay... Could you rebase this? 🙂

@SimenB
Copy link
Member

SimenB commented Oct 11, 2021

I merged in some of main, but I'm not 100% how to resolve the conflict. Sorry!

@natealcedo
Copy link
Contributor Author

I'll take a look at this next week no sweat :)

@keeganwitt
Copy link
Collaborator

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',
  );
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants