Skip to content

Tests exiting code 1 when no tests are found #5283

@stramel

Description

@stramel

Is this a bug report?

Yes

Did you try recovering your dependencies?

N/A

Which terms did you search for in User Guide?

test, tests, ci, jest

Environment

Noticed on CI server but also happening locally.

using react-scripts v2

Steps to Reproduce

  1. Run yarn test from project without tests.

Expected Behavior

Shouldn't exit code 0 or have a flag to enable/disable the behavior

Actual Behavior

Exited code 1

❯ cross-env CI=true yarn test --ci
yarn run v1.9.4
$ react-scripts test --ci
No tests found
In /Users/stramel/Projects/my-package
  9 files checked.
  testMatch: /Users/stramel/Projects/my-package/src/**/__tests__/**/*.{js,jsx},/Users/stramel/Projects/my-package/src/**/?(*.)(spec|test).{js,jsx} - 0 matches
  testPathIgnorePatterns: /node_modules/ - 9 matches
Pattern:  - 0 matches
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions