This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
jest option 'setupFiles' should be added to solve testing problem with react-slick? #192
Closed
Description
Is this a bug report?
yes
Can you also reproduce the problem with npm 4.x?
not relevant
Which terms did you search for in User Guide?
I read the chapter about testing: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests
Environment
node -v
: v6.9.5npm -v
: 5.5.1yarn --version
(if you use Yarn): N/Anpm ls react-scripts-ts
(if you haven’t ejected): 2.8.0
Then, specify:
- Operating system: Linux
- Browser and version (if relevant):
Steps to Reproduce
- One of our components use react-slick
- Run 'CI=true npm test'
- I get an error:
> react-scripts-ts test --env=jsdom
FAIL src/App.test.tsx
● Test suite failed to run
matchMedia not present, legacy browsers require a polyfill
at new MediaQueryDispatch (node_modules/enquire.js/src/MediaQueryDispatch.js:15:15)
at Object.<anonymous> (node_modules/enquire.js/src/index.js:2:18)
at Object.<anonymous> (node_modules/react-slick/lib/slider.js:37:38)
at Object.<anonymous> (node_modules/react-slick/lib/index.js:3:18)
(rest of call stack shows proprietary code and has been deleted)
- Try to apply solution from here (https://github.com/akiran/react-slick#test-setup): create test-setup.js as described and set the 'setupFiles' option for jest (as describe)
- Run 'CI=true npm test'
- You get an error:
Out of the box, Create React App only supports overriding these Jest options:
• collectCoverageFrom
• coverageReporters
• coverageThreshold
• snapshotSerializers.
These options in your package.json Jest configuration are not currently supported by Create React App:
• setupFiles
If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.
Expected Behavior
I would expect that 'CI=true npm test' works fine and runs the test.
I would expect that the jest option 'setupFiles' is supported.
Actual Behavior
See above the error messages I got.
Reproducible Demo
Not available at the moment, sorry. I will try to create one soon.
The application just created using the README.md of this project does not reproduce this problem, because it does not use react-slick.
Metadata
Metadata
Assignees
Labels
No labels