You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update documentation for testing dependency with Enzyme #1981
The information in the User Guide should be updated to instruct users to install react-test-renderer instead of react-addons-test-utils.
Expected behavior
With freshly bootstrapped app and with enzyme and react-addons-test-utils installed as instructed, the following test should pass:
import React from 'react';
import { shallow } from 'enzyme';
import App from './App';
it('renders without crashing', () => {
shallow(<App />);
});
Actual behavior
I see the following warnings in the console:
console.error node_modules/fbjs/lib/warning.js:36
Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.
console.error node_modules/fbjs/lib/warning.js:36
Warning: Shallow renderer has been moved to react-test-renderer/shallow. Update references to remove this warning.
If I uninstall react-addons-test-utils then Enzyme shows this warning:
console.error node_modules/enzyme/build/react-compat.js:148
react-dom@15.5+ and react-test-renderer are implicit dependencies when usingreact@15.5+ with enzyme. Please add the appropriate version to yourdevDependencies. See https://github.com/airbnb/enzyme#installation
If I install react-test-renderer then test passes:
PASS src/App.test.js
✓ renders without crashing (8ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 2.351s
Ran all test suites.
Environment
npm ls react-scripts (if you haven’t ejected): react-scripts@0.9.5
Activity