A little React greeting.jsx component is tested (inside Cypress test runner) using:
- cypress/integration/enzyme-spec.js using Enzyme
- import
enzyme
fromnode_modules
. - extend chai assertions with
chai-enzyme
.
- import
- cypress/integration/react-testing-library-spec.js using react-testing-library
- cypress/integration/cypress-react-unit-test-spec.js using cypress-react-unit-test
The screenshot below shows how cypress-react-unit-test mounts a React component as "mini" web application.
Read Sliding Down the Testing Pyramid for more details about testing individual components by mounting them in the Cypress test runner's iframe.