Closed
Description
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
Manual Mocks
Environment
node -v
: v9.8.0npm -v
: 5.6.0yarn --version
(if you use Yarn): 1.5.1npm ls react-scripts
(if you haven’t ejected): [email protected]
Then, specify:
- Operating system: macOS High Sierra
- Browser and version (if relevant): N/A
Steps to Reproduce
- Create a new project with create-react-app.
- Write a jest test that makes use of manual mocks. Ensure the test passes and that the mocked value is being used in the test.
- Upgrade react-scripts to 2.0.0-next.66cc7a90.
- Run the tests again and observe that the test no longer uses the mocked value
Expected Behavior
Jest manual mocks should still take effect
Actual Behavior
Jest manual mocks no longer work
Reproducible Demo
https://github.com/TLadd/manual-mocks-cra-test
The master branch is a newly-created CRA app and uses react-scripts 1.1.4. The only change is adding lodash.uniqueid as a dependency to the project, a src/uniqueId.js, src/tests/uniqueId.js, and mocks/lodash.uniqueid.js. The test just ensures that lodash.uniqueid returns the mocked value setup in mocks/lodash.uniqueid.js. The test passes on master.
On branch react-scripts-v2, the only change made is to update to [email protected], and now the test fails. The mocks is no longer taking effect.