Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest prints superfluous warning when ran with '--passWithNoTests' and there are no tests #8594

Closed
kaykayehnn opened this issue Jun 22, 2019 · 2 comments · Fixed by #8595
Closed

Comments

@kaykayehnn
Copy link
Contributor

🐛 Bug Report

When jest runs but there are no tests to execute, by default it exits with code 1 (error) and prints the following message

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /path/to/my/project
  1 file checked.
  testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 0 matches
  testPathIgnorePatterns: /node_modules/ - 1 match
  testRegex:  - 0 matches
Pattern:  - 0 matches

When running with --passWithNoTests, jest exits with code 0 but the same message gets printed.

Expected behaviour

Jest does not print warning when ran with --passWithNoTests

Actual behaviour

Jest prints warning when ran with --passWithNoTests

To Reproduce

In an empty directory:

  1. yarn add jest
  2. Add "test": "jest --passWithNoTests" to scripts in package.json
  3. yarn test

Link to reproducible repo

kaykayehnn/jest-pass-with-no-tests-bug

Environment
  System:
    OS: macOS 10.14.5
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
  Binaries:
    Node: 12.4.0 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.9.1-next.0 - ~/.npm-global/bin/npm
  npmPackages:
    jest: ^24.8.0 => 24.8.0

I can submit a PR for this if that's okay.

@thymikee
Copy link
Collaborator

PRs always welcome :)

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants