Files
create-react-app/test/README.md
Joe Haddad 5fecfee237 Clean up the behavior tests (#5365)
* Speed up installs with pnp

* Move to a better relative path test

* Continue work on new test organization

* Move mjs test to new enhanced tests

* Move over last legacy test

* Update behavior e2e script

* Add first iteration of instructions to test readme

* Add some more bad instructions

* Split test command into multiple lines

* Use two workers (do not run in band)

* Bump install timeout

* No global pollution

* Fix PnP support via standard run mechanism

* Prevent circular serve command

* Silent yarn execs

* Fix common commands by using a shell

* Run with npx instead of Yarn

* Remove unused scripts

* Wait for localhost and fix script booting with PnP

* Don't pnp locally because links will cause module resolution to whine

* lint-staged is annoying

* Strip Yarn out of execa runs

* Set default license if none specified

* Don't impose worker limit

* Disable pnp for webpack messages

* Add missing dependency

* Disable timeout and rely on Jest

* Only use 2 jest workers

* Add missing dependency
2018-10-10 11:05:15 -04:00

46 lines
1.6 KiB
Markdown

# Create React App End-to-End Tests
## Usage
These tests ensure various functionality contracts are upheld across dependency upgrades.
To get started locally, run `cd packages/react-scripts/ && yarn link; cd ../../test/ && ../node_modules/.bin/jest --watchAll`.
It's suggested that you filter down tests to avoid re-running everything. The most common tests will be the webpack messages.<br>
To only run the webpack messages, type `p` followed by `webpack-message` and press `[enter]`.
## How do these work?
### `fixtures/`
Each `fixture/` gets spun up in a temporary directory and has its dependencies installed with Yarn PnP (for speed).<br>
To opt-out of PnP, create a `.disable-pnp` file in the specific fixture directory.
A global (`testSetup`) is created which has a few interesting properties:
- `testSetup.testDirectory`: the directory containing the test application
- `testSetup.scripts`: an object allowing you to invoke `react-scripts` commands and friends
All tests for each `fixture/` are then ran.
#### `testSetup.scripts`
##### `start`
This will run the `start` command, it can be ran asynchronously or blocking if `{ smoke: true }` is used.<br>
If ran asynchronously, it will return the `port` and a `done` function to clean up the process.
If ran blocking, it will return the `stdout` and `stderr` of the process.
##### `build`
This will run the `build` command and return the `stdout` and `stderr` of the process.
##### `test`
This will run the `test` command and return the `stdout` and `stderr` of the process.
##### `serve`
This will run serve the application.
It will return the `port` and a `done` function to clean up the process.