Files
create-react-app/test
Robert van Steen e7a2d6168a Set baseUrl from jsconfig.json/tsconfig.json (#6656)
* Set baseUrl from jsconfig.json/tsconfig.json

* Resolve the path for loading modules

* Add tests for jsconfig.json

* Add jsconfig.json

* Update packages/react-scripts/scripts/start.js

* Move baseUrl test to config folder

* Remove alias test

* Use chalk from react-dev-utils

* Add lost absolute file for typescript baseUrl test

* Update packages/react-scripts/config/modules.js

* Update other references of useTypeScript to hasTsConfig

* Fix casing of TypeScript

* Keep respecting NODE_PATH for now to support multiple module paths.

* Add test for NODE_PATH

* Add fallback if NODE_PATH is not set.

* Fix node path behavior tests

* Remove debugging code from behavior test suite

* Remove more debugging code

* Show NODE_PATH deprecation warning during build


Co-authored-by: Ian Sutherland <ian@iansutherland.ca>
Co-authored-by: Brody McKee <mrmckeb@users.noreply.github.com>
Co-authored-by: Jack Zhao <jzhao@fb.com>
2019-04-16 15:08:24 -06:00
..
2018-10-10 11:05:15 -04:00

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.
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).
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.
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.