Skip to content

Allow npm test to not run in watch mode for better cross-platform / tooling CI. #1137

@cchamberlain

Description

@cchamberlain

I've been using create-react-app in conjunction with lerna repos and for the most part its been an awesome experience. The one issue I've been seeing is when trying to issue lerna run test commands to test all packages that have a "test" script. Since create-react-app defaults to entering watch mode on test, it hangs.

After some digging it looks like I might be able to set a CI environment variable to disable the watch mode, however this does not work well due to the nuances of setting environment variables cross platform.

Something as simple as changing the default from

    "test": "react-scripts test --env=jsdom",

to

    "test": "react-scripts test --env=jsdom --watch",

would allow me to simply turn it off. Conversely adding an optional --no-watch or --single-run flag would solve the problem.

I'm happy to submit a PR, but wanted to get some feedback first on the internal direction regarding whether this has been considered in the past, and the reasoning around the current implementation. I get that its a nice experience for the casual user, but at the cost of CI and incompatibility with lerna there should be some sort of escape hatch (short of eject).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions