Files
cypress/npm/react/examples/react-scripts
Lachlan Miller 8e894a0fdb fix(webpack-dev-server): remove output.publicPath from webpack-dev-server (#15839)
* fix: remove publicPath in react-scripts if it is present

* fix: remove publicPath in react-scripts if it is present

* fix: remove publicPath in webpack-dev-server regardless

* fix: add root path

* chore: revert

* fix: remove user base path

* remove unused function

* test: add unit test for make webpack config

* chore: make purpose for fake url more clear

* do not include local filesystem path in snapshot
2021-04-09 08:23:01 -04:00
..

example: react-scripts

A typical project using react-scripts with components and matching component tests residing in the src folder.

Usage

  1. Make sure the root project has been built .
# in the root of the project
npm install
npm run build
  1. Run npm install in this folder to symlink the @cypress/react dependency.
# in this folder
npm install
  1. Start Cypress
npm run cy:open
# or just run headless tests
npm test

Notes

App test

The spec src/Logo.cy-spec.js directly imports SVG into React spec file. The spec src/resources.cy-spec.js confirm that static resources like SVG and fonts load correctly.

Env files

React Scripts automatically loads .env files. The NODE_ENV is set to test when loading scripts, thus the .env.test files are combined and the final process.env contains an object with string values.

Env test

See the test in src/App.cy-spec.js and local .env files in this folder.