-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Plugin does not ignore commented-out expect
statements or test exclusions with .only
#1
Comments
expect
statements or test exclusions with .only
Hey @huy-nguyen thanks for raising this issue and nice catch! I'm on holiday at the moment and don't have a computer with me 😢 so I won't be able to fix this right now. How would you feel about sending a PR with the fix for the commented out expects? The basic logic of this plugin is that it turns the test into a string and matches on all On line 42 in src/index.js. You would need to put a normalised version of const normalisedCode = code.replace(/\/\/(.*)/g, '').replace(/\/\*([\s\S]*)\*\//g, ''); If you could add test cases for this with the following formats that would be great. test('returns 2 when given 1 and 1', () => {
/*
expect(1).toBe(1);
*/
const a = 1; /* expect(a).toBe(1) */
const b = 1; // expect(b).toBe(1)
expect(add(a, b)).toBe(2);
// expect (add(1, 2)).toBe(3);
}) If you don't have time to send a PR no worries dude just let me know and I'll try and find someone who can help in my absence 😄 |
As for the second issue with |
PR in #2 |
Thanks @huy-nguyen for the issue and @hiddentao for the PR. Now got to figure out how to release without a computer 😂 Once I've published the fix I'll let you know. |
Re-opening for the issue with focussed tests and Jests hasAssertions |
@huy-nguyen Jest hasAssertions has been fixed in the above PR, just waiting on a release of Jest. |
I've just published v0.0.2 with the fix for commented out expects and the issue in jest should be released within a week 🎉 |
Bug
babel-jest-assertions
version: 0.0.1node
version: 8.3.0npm
(oryarn
) version: 5.3.0Relevant code or config
What you did: Run
jest
on the above test file.What happened (please provide anything you think will help):
jest-babel-assertions
incorrectly insertsexpect.asertions
for the commented outexpect
, causing the test to fail:Another file that causes the same problem:
In this case the error is on the
does not run
test.Reproduction repository (if possible):
The text was updated successfully, but these errors were encountered: