Code React Sweetly
/
Testing React Components
Testing React Components
https://leanpub.com/code-react-sweetly
What’s the Difference Between a Test Runner and a React Component Testing Tool?
https://leanpub.com/code-react-sweetly
Get the Right Node and NPM Version
https://leanpub.com/code-react-sweetly
Create a New Directory for Your Project
https://leanpub.com/code-react-sweetly
Create a package.json File
https://leanpub.com/code-react-sweetly
Install React and ReactDOM
https://leanpub.com/code-react-sweetly
Configure Your Test Environment
https://leanpub.com/code-react-sweetly
Specify Jest as Your App’s Test Runner Tool
https://leanpub.com/code-react-sweetly
Initialize ESLint’s Configuration
https://leanpub.com/code-react-sweetly
Install ESLint’s Test Plugins
https://leanpub.com/code-react-sweetly
JavaScript Guide to Test React Components
https://leanpub.com/code-react-sweetly
Integrate ESLint with the test plugins
https://leanpub.com/code-react-sweetly
Import
jest-dom
’s matchers
https://leanpub.com/code-react-sweetly
Install the code compiler
https://leanpub.com/code-react-sweetly
Configure Babel to compile your code
https://leanpub.com/code-react-sweetly
Configure Jest to set up
jest-dom
before running tests
https://leanpub.com/code-react-sweetly
Configure Jest’s testing environment
https://leanpub.com/code-react-sweetly
Create the app’s test script
https://leanpub.com/code-react-sweetly
Write your test case
https://leanpub.com/code-react-sweetly
Develop a React component
https://leanpub.com/code-react-sweetly
Run the test
https://leanpub.com/code-react-sweetly
Create the entry script
https://leanpub.com/code-react-sweetly
Create the web page
https://leanpub.com/code-react-sweetly
Install the app’s module bundler
https://leanpub.com/code-react-sweetly
Configure Parcel to ignore Babel
https://leanpub.com/code-react-sweetly
Run your application
https://leanpub.com/code-react-sweetly
Refactor the test code
https://leanpub.com/code-react-sweetly
Refactor your React component
https://leanpub.com/code-react-sweetly
Rerun the test
https://leanpub.com/code-react-sweetly
TypeScript Guide to Test React Components
https://leanpub.com/code-react-sweetly
Integrate ESLint with the test plugins
https://leanpub.com/code-react-sweetly
Import
jest-dom
’s matchers
https://leanpub.com/code-react-sweetly
Install TypeScript and type definitions
https://leanpub.com/code-react-sweetly
Configure the TypeScript compiler
https://leanpub.com/code-react-sweetly
Install the Jest transformer
https://leanpub.com/code-react-sweetly
Configure Jest to compile TypeScript files
https://leanpub.com/code-react-sweetly
Configure Jest to set up
jest-dom
before running tests
https://leanpub.com/code-react-sweetly
Configure Jest to read TypeScript configuration files
https://leanpub.com/code-react-sweetly
Configure Jest’s testing environment
https://leanpub.com/code-react-sweetly
Create the app’s test script
https://leanpub.com/code-react-sweetly
Write your test case
https://leanpub.com/code-react-sweetly
Develop a React component
https://leanpub.com/code-react-sweetly
Run the test
https://leanpub.com/code-react-sweetly
Create the entry script
https://leanpub.com/code-react-sweetly
Create the web page
https://leanpub.com/code-react-sweetly
Install the app’s module bundler
https://leanpub.com/code-react-sweetly
Optional: Configure Parcel to use the TypeScript compiler
https://leanpub.com/code-react-sweetly
Run your application
https://leanpub.com/code-react-sweetly
Refactor the test code
https://leanpub.com/code-react-sweetly
Refactor your React component
https://leanpub.com/code-react-sweetly
Rerun the test
https://leanpub.com/code-react-sweetly
And that’s it!
https://leanpub.com/code-react-sweetly
Useful Resources
https://leanpub.com/code-react-sweetly
Up next
Epilogue
In this chapter
Testing React Components
What’s the Difference Between a Test Runner and a React Component Testing Tool?
Get the Right Node and NPM Version
Create a New Directory for Your Project
Create a package.json File
Install React and ReactDOM
Configure Your Test Environment
Specify Jest as Your App’s Test Runner Tool
Initialize ESLint’s Configuration
Install ESLint’s Test Plugins
JavaScript Guide to Test React Components
TypeScript Guide to Test React Components
Useful Resources