Open MikeTheCanuck opened 6 years ago
Implementing the second test to App.test.js
meant installing and configuring enzyme
per the instructions here:
https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#testing-components
That is:
yarn add enzyme enzyme-adapter-react-16 react-test-renderer
And adding the basic configuration for src/setupTests.js
.
However, Travis caught an error in just this configuration, which wasn't observed in local testing:
12.11s$ yarn test
yarn test v0.27.5
$ react-scripts test --env=jsdom
PASS src/components/NewEncounter.test.js
FAIL src/App.test.js
● <App /> › should render its children
TypeError: Cannot read property 'eql' of undefined
at Object.it (src/App.test.js:20:42)
at new Promise (<anonymous>)
at Promise.resolve.then.el (node_modules/p-map/index.js:46:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 failed, 2 passed, 3 total
Snapshots: 0 total
Time: 9.149s
Ran all test suites.
error Command failed with exit code 1.
Question: should the enzyme*
dependencies be listed in dependencies or in devDependencies? I'm seeing conflicting indications between these two resources:
http://airbnb.io/enzyme/
https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#testing-components
Each of the React Components should include the kinds of smoke tests prescribed by Facebook here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#testing-components