Introduction to Enzyme testing for React.
Enzyme was developed by Airbnb for testing React components’ outputs.
Some code that is wrong will fail to compile. Why will this snippet fail to compile?
function App() {
return (
<div className="App">
<header className="App-header">
Login
</header>
</div>
<Login />
);
}
Often times however, our code compiles without errors but fails at runtime.
Create-react-app install Jest test runner.
Jest will look for test files with any of the following popular naming conventions:
This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment