-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Adding --noDuplicateMockWarn cli option #6037
Conversation
This option disables the “jest-haste-map: duplicate manual mock found” warning
Codecov Report
@@ Coverage Diff @@
## master #6037 +/- ##
======================================
Coverage 64.3% 64.3%
======================================
Files 217 217
Lines 8317 8317
Branches 3 4 +1
======================================
Hits 5348 5348
Misses 2968 2968
Partials 1 1
Continue to review full report at Codecov.
|
Will try to fix that error this afternoon for you |
Just ran all code locally, but didn't receive the error, sorry I can't help. |
I'm unable to reproduce the error either. What is the error saying / indicative of? Also, is there a way to re-run the test-node-8 checks short of pushing a new change? |
Seems like I figured out the issue 😀 |
Does this make sense as a cli flag? Seems more like config - you don't want to turn off the warnings for a single run, you either want them there or not every time |
I also tested this as a config option, and it works there, too; see the image labeled "New output in config file" above. If you mean that it should only be available as config, that does make sense. However, I'm not sure how to make it available as a config option but not as a flag from the cli. Is it just a matter of removing it from |
Will there be an option i package.json as well? |
@beckend yes, this includes a config option, which will be available in the package.json |
Any review comments or word on if / when this can get merged? |
@cpojer what do you think about this? |
I’d much rather overhaul the entire mocking system before merging an option like this tbh. |
Actually, I think @rubennorte’s diff around hasteImpl will make this warning be a thing of the past. |
@cpojer the mock warning is displayed before the worker processes the file, so the change in |
@rubennorte oh good point. Maybe we can change that and together with your PR it would solve all the problems. |
@cpojer sounds good. I'll do that. |
We'll go that route, so I'm closing this PR here. @kgroat thanks so much for sending a PR to Jest. I hope the alternative solution we'll provide will work for you too! |
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
This option disables the
jest-haste-map: duplicate manual mock found
warning as discussed in #2070. This is a temporary solution to the underlying problem, but one that will allow users to stop seeing the warning when running their test suite.Test plan
I've ensured that the existing
HasteMap
test verifying that the warning is logged still succeeds, and added a test to show that, when the option is set to true, the warning is not logged.Also tested the new cli arg.
Old output:
New output in config file:
New output through cli argument: