enzymejs / enzyme

JavaScript Testing utilities for React
https://enzymejs.github.io/enzyme/
MIT License
19.96k stars 2.01k forks source link

Update jest.md #2499

Open wyatt-troia opened 3 years ago

wyatt-troia commented 3 years ago

Add note about skipping setting 'setupFilesAfterEnv' if using create-react-app. If you try to do so when using create-react-app, you get the following error:

(base) ➜  component-library git:(setup) ✗ npm run test

> component-library@0.1.0 test
> react-scripts test

We detected setupFilesAfterEnv in your package.json.

Remove it from Jest configuration, and put the initialization code in src/setupTests.js.
This file will be loaded automatically.
ljharb commented 3 years ago

Skipping this step means your enzyme adapter isn't configured. What's the workaround?

codecov[bot] commented 3 years ago

Codecov Report

Merging #2499 (6017756) into master (cdfb1c6) will decrease coverage by 87.52%. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #2499       +/-   ##
==========================================
- Coverage   96.12%   8.60%   -87.53%     
==========================================
  Files          49      16       -33     
  Lines        4004    1802     -2202     
  Branches     1123     498      -625     
==========================================
- Hits         3849     155     -3694     
- Misses        155    1647     +1492     
Impacted Files Coverage Δ
packages/enzyme/src/ShallowWrapper.js 4.57% <0.00%> (-94.49%) :arrow_down:
packages/enzyme/src/ReactWrapper.js 6.56% <0.00%> (-92.90%) :arrow_down:
packages/enzyme/src/RSTTraversal.js 7.27% <0.00%> (-90.00%) :arrow_down:
packages/enzyme/src/validateAdapter.js 10.00% <0.00%> (-90.00%) :arrow_down:
packages/enzyme-shallow-equal/src/index.js 11.76% <0.00%> (-88.24%) :arrow_down:
packages/enzyme/src/EnzymeAdapter.js 12.50% <0.00%> (-87.50%) :arrow_down:
packages/enzyme/src/Utils.js 7.72% <0.00%> (-87.13%) :arrow_down:
packages/enzyme/src/Debug.js 14.86% <0.00%> (-85.14%) :arrow_down:
packages/enzyme/src/configuration.js 18.18% <0.00%> (-81.82%) :arrow_down:
packages/enzyme/src/selectors.js 14.72% <0.00%> (-81.73%) :arrow_down:
... and 37 more

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 cdfb1c6...6017756. Read the comment docs.