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 won't run a specific test spec file from CLI

See original GitHub issue

Do you want to request a feature or report a bug? Bug report What is the current behavior? When I run all my test spec files together jest runs them all. But when I want to run a single spec file using ‘jest path/to/my-test.js’ I get the following error:

No tests found in C:\Users\User\Documents\folder12 files checked. testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 4 matches testPathIgnorePatterns: \\node_modules\\ - 12 matchesPattern: .\_tests_\API\tickers.spec.jS - 0 matches error An unexpected error occurred: "Command failed.Exit code: 1

Code structure: tests API tickers.spec.js

What is the expected behavior? tickers.spec.js should run

Run npx envinfo --preset jest in your project directory and paste the results here System: OS: Windows 10 CPU: x64 Intel® Core™ i7-5600U CPU @ 2.60GHz Binaries: Yarn: 1.5.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
thymikeecommented, May 21, 2018

Wonder if this PR https://github.com/facebook/jest/pull/5941 fixes it? You should be able to try this using jest@beta

1reaction
SimenBcommented, Apr 17, 2018

Seeing as you’re on windows, have you tried jest path\to\my-test.js?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I test a single file using Jest? - node.js - Stack Overflow
To access jest directly on the command line, install it via npm i -g jest-cli or yarn global add jest-cli . Then simply...
Read more >
Jest CLI Options
If Jest doesn't exit at the end of a test run, it means external resources are still being held on to or timers...
Read more >
How do I test a single file using Jest | Edureka Community
I am able to test multiple files using Jest, but I cannot figure out how to test a single file. I have: Run...
Read more >
Two useful ways to easily run a single test using Jest
Another easier way to run a specific or single test with Jest without changing the code is by using the testNamePattern CLI parameter....
Read more >
Angular CLI: “ng test” with Jest in 3 minutes (v2) - Medium
Replace jasmine in types array with jest. You want your tests to be type-checked against Jest typings and not Jasmine · Remove test.ts...
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