Skip to content

Don't force "--watch" into Jest #784

Closed
@alexewerlof

Description

@alexewerlof

If you are reporting a bug, please fill in below. Otherwise feel to remove this template entirely.

Description

I want the tests to terminate after running once. But there doesn't seem to be any way to disable this behavior except setting the CI environment variable like: "test": "CD=true react-scripts test --env=jsdom", in package.json. I traced the source of this behavior to these lines in test.js

// Watch unless on CI
if (!process.env.CI) {
  argv.push('--watch');
}

I understand that watching can be good when in the development cycle but when I want to run the tests in a pipeline or some script or git push hooks, I want to escape this mechanism.

Expected behavior

One of these

  1. Make the npm test run only once and then make another one called npm run test:watch that watches.
  2. Maybe add another package.json script called npm run test:once

Actual behavior

Tell us what actually happens.

Environment

react-scripts@0.4.1
node@6.5.0
npm@3.10.3

I can make a PR if this behavior is confirmed.

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