question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`jest <regexForTestFiles>` CLI not picking up tests

See original GitHub issue

jest <regexForTestFiles> CLI not picking up tests.

Perhaps related to https://github.com/facebook/jest/pull/5582

What is the current behavior?

Barebones demo repo: https://gitlab.com/MadLittleMods/jest-test-regex-issue-barebones-test-case1

Reproduction steps
  1. Install jest@22.4.2
  2. Save a file with some tests in some-test.js
  3. jest some-test.js
  4. Notice, No tests found
$ jest some-test.js
No tests found
In /jest-test-regex1
  3 files checked.
  testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 0 matches
  testPathIgnorePatterns: /node_modules/ - 3 matches
Pattern: some-test.js - 0 matches

What is the expected behavior?

The jest <regexForTestFiles> CLI syntax should match files regardless of testMatch config.


This previously worked with jest@22.3.0 but I am unable to downgrade successfully and confirm because it always installs jest-cli@22.4.2. Any tips? Related https://github.com/facebook/jest/issues/405, https://github.com/facebook/jest/issues/3391

This installs jest@22.3.0 and jest-cli@22.3.0 but throws other errors

$ npm install jest@22.3.0 && cd ./node_modules/jest && rm -rf ./node_modules/jest-cli && npm install jest-cli@22.3.0 && cd ../../

$ npm test

TypeError: (0 , (_jestUtil || _load_jestUtil(...)).validateCLIOptions) is not a function
    at buildArgv (/jest-test-regex1/node_modules/jest/node_modules/jest-cli/build/cli/index.js:133:58)
    at Object.<anonymous> (/jest-test-regex1/node_modules/jest/node_modules/jest-cli/build/cli/index.js:41:20)
    at Generator.next (<anonymous>)
    at step (/jest-test-regex1/node_modules/jest/node_modules/jest-cli/build/cli/index.js:53:2732)
    at /jest-test-regex1/node_modules/jest/node_modules/jest-cli/build/cli/index.js:53:2962
    at new Promise (<anonymous>)
    at Object.<anonymous> (/jest-test-regex1/node_modules/jest/node_modules/jest-cli/build/cli/index.js:53:2643)
    at Object.run (/jest-test-regex1/node_modules/jest/node_modules/jest-cli/build/cli/index.js:53:48)
    at Object.<anonymous> (/jest-test-regex1/node_modules/jest/node_modules/jest-cli/bin/jest.js:16:27)
    at Module._compile (module.js:643:30)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
MadLittleModscommented, Mar 7, 2018

This comment explains it well,

For more context, we added support for this without an arg in #3882, and decided to roll back in #5544 and #5582, since we decided that Jest should never run tests that are excluded through the config

@rickhanlonii, https://github.com/facebook/jest/issues/5735#issuecomment-371146221

I was caught in the between rollout and rollback where this worked and all of the sudden didn’t work in a minor release.

Thanks for the extra info 🙂

0reactions
github-actions[bot]commented, May 12, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest CLI Options
It is possible to run test suites by providing a pattern. Only the files that the pattern matches will be picked up and...
Read more >
Jest CLI Options - GitHub Pages
It is possible to run test suites by providing a pattern. Only the files that the pattern matches will be picked up and...
Read more >
Dynamically matching files in Jest | by Romain Kelifa - Medium
Article of today is about dynamically matching files for your tests run with Jest. Use case. Let's say you have 2 different kinds...
Read more >
Jest regex to match certain test files - Stack Overflow
js . Running Jest: jest ".*\\.integration\\.js". produces this error: No tests found, exiting ...
Read more >
vue/cli-plugin-unit-jest
Any js(x)/ts(x) files inside __tests__ directories. Usage: vue-cli-service test:unit [options] <regexForTestFiles>. All Jest command line ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found