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

Unable to find tests when path includes parentheses #2381

Closed
benfogel opened this issue Dec 20, 2016 · 26 comments · Fixed by #5941
Closed

Unable to find tests when path includes parentheses #2381

benfogel opened this issue Dec 20, 2016 · 26 comments · Fixed by #5941

Comments

@benfogel
Copy link

benfogel commented Dec 20, 2016

Bug

When running npm test on a project which contains parentheses in the path, no tests are found.

Example repo here: https://github.com/benfogel/jest-18-parenthesis-bug

What is the expected behavior?
A test should be found and run.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest 18
Windows 7
NPM 3.10.8

@thymikee
Copy link
Collaborator

thymikee commented Jan 10, 2017

Based on this test it's a known limitation.

@cpojer do we have plans on fixing Windows issues like this?

@cpojer
Copy link
Member

cpojer commented Jan 11, 2017

yeah this should be made to work on windows. The integration tests are disabled on windows mostly because nobody had time to go through and fix/enable the tests. cc @Daniel15 do you have any time to help?

@PeteDuncanson
Copy link
Contributor

Related: #3121

@rally25rs
Copy link

Looks like this isn't the first time it's broken: #1081
I just had this issue trying to set up a Jenkins CI server because the default workspace on Windows is "C:\Program Files (x86)\Jenkins\workspace<project name>"

@siirila
Copy link

siirila commented Jun 20, 2017

I found that you can work around this restriction if you are on a Windows system that supports short names for paths by using the short name, which shouldn't contain the parenthesis, for the rootDir config property.

@cpojer
Copy link
Member

cpojer commented Aug 24, 2017

I think this is fine in the current alpha, jest@test.

@cpojer cpojer closed this as completed Aug 24, 2017
@ansballard
Copy link

Just tested with jest@test (v21.0.0-alpha.2) . Still has issues with paths that include parentheses on windows. Jest finds and runs my tests from C:\Program Files\tmp\project, but not from C:\Program Files\tmp (x86)\project.

Windows Version: 10.0.15063 Build 15063
Node: 8.4.0
NPM: 5.3.0
Jest: v21.0.0-alpha.2

@cpojer cpojer reopened this Aug 24, 2017
@cpojer
Copy link
Member

cpojer commented Aug 24, 2017

That sucks. It would be great if you could troubleshoot it and send a PR and test to fix it as I don't have access to any Windows machines.

@ansballard
Copy link

I'd be happy to, but I'm not sure if I'll have the time in the near future. I spent an hour or so digging through to see if it was a quick fix but I couldn't track down the issue, and I can't spend any more time than that from work. Sorry!

@robertmain
Copy link

robertmain commented Nov 16, 2017

For me npx jest works - however npm run-script unit (which executes jest test/unit/specs --coverage under the hood) doesn't work.

@sean-killeen
Copy link

Hi Guys,

For me, Even with no special characters in the test path I still can't get tests to run.
image

if I use jest with path to the spec they will execute but otherwise not. Any help greatly appreciated.

@SimenB
Copy link
Member

SimenB commented Feb 21, 2018

why do you run jest/bin/jest? seems like jest thinks /bin/jest is the pattern...

@ansballard
Copy link

@sean-killeen That seems like a separate issue, you may want to create a new issue with the full template filled out for better help.

@sean-killeen
Copy link

@SimenB @ansballard Thanks for your help. So I got this resolved by using the global installation of Jest rather than referencing it through my node_modules.

@c-vetter
Copy link

c-vetter commented Mar 8, 2018

@sean-killeen
Personally, I completely eschew global installation of any modules needed for node projects and would advise you to do the same unless you have control over all machines running your project. Even in grunt projects, I do not use grunt-cli. I've repeatedly seen problems in systems relying on global packages due to divergent versions. I use jest locally through npm, no issues there. I'm running Windows 10. Maybe try that as well? Hope this helps 😁

@nweldev
Copy link

nweldev commented Apr 1, 2018

Same issue when trying to run the https://github.com/nrwl/nx e2e on Windows 7 (jest version 20.0.4)
see https://github.com/nrwl/nx/blob/4184bb2d133a7d9fe3eda0ddd3fda40ae5082b1c/scripts/e2e.sh
directly using ./node_modules/.bin/jest, a global install, or npx, didn't resolved anything.

No tests found
In D:\git\gh\nx
  295 files checked.
  testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 45 matches
  testPathIgnorePatterns: \\node_modules\\ - 295 matches
Pattern: "build/e2e/schematics/command-line.test." - 0 matches

FYI : I use git-bash

@KyleScharnhorst
Copy link

Any idea when this gets into production? Using v22.4.3 and getting issues when trying to us CI with Jenkins.
Path: C:\Program Files (x86)\Jenkins\workspace\Outages\app\server

@SimenB
Copy link
Member

SimenB commented Apr 11, 2018

We're gearing up for Jest 23, so some ways off.

You can install jest@beta to at least test that it works

@bharathvaj-ganesan
Copy link

Still it doesn't work with WIN : 10 jest : 23.0.0-alpha.6r

@SimenB
Copy link
Member

SimenB commented Apr 12, 2018

:(

@SimenB SimenB reopened this Apr 12, 2018
@SimenB
Copy link
Member

SimenB commented Apr 12, 2018

@bharathvaj1995 mind setting up a reproduction?

@iondrimba
Copy link

My workaround for a personal project #7842

@MattKohnen
Copy link

Also unable to find tests on Mac when asterisk (*) in path:

"No tests found, exiting with code 1"

@github-actions
Copy link

This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Feb 26, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.

@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 Apr 28, 2022
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.