Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For Jest 15 we are going to ship with a ton of new defaults that should make the experience of using Jest better. With this, I also removed a bunch of outdated documentation from the website – however I feel like we should completely rewrite the documentation on the website and replace it with better, useful, step-by-step guides (cc @lacker).
This diff:
timers: 'fake' | 'real'
config option for global control.jest.resetModules
and aresetModules
config option for better control..test.js
and.spec.js
in the defaulttestRegex
.jest.unmock
is used to either enable automocking or remove the unmock calls. Similarly Jest now logs a warning if automocking isn't used butunmockedModulePathPatterns
is specified.test
orit
calls don't print a>
right after the*
bullet. (* works
instead of* > works
). I know this should have gone into separate diffs, but you know, sue me.testEnvData
config option.At Facebook we will continue to use automocking and fake timers for the foreseeable future and both features will continue to be part of Jest long term. Especially the auto mocking feature at this point is easy to maintain and the explicit auto-mocking using
jest.mock
is incredibly valuable. However, it makes a lot of sense for libraries and beginners to start with sane defaults. Automocking is valuable for big organizations that do not have a unit testing culture. I will elaborate this in the release blog post but wanted to give a few hints in here.TODO: I'll add a few tests for the new errors tomorrow :)
cc @gaearon