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

testPathDirs 0 matches on windows #1551

Closed
dskgry opened this issue Sep 1, 2016 · 25 comments
Closed

testPathDirs 0 matches on windows #1551

dskgry opened this issue Sep 1, 2016 · 25 comments

Comments

@dskgry
Copy link

dskgry commented Sep 1, 2016

I just upgraded from jest 14.1.0 to jest 15.0.2 and now no tests are found anymore - the testPathDir never matches anything (I tried different variations). Output is:

No tests found
41 files checked.
testPathDirs: C:\Users\dskgry\app\src - 0 matches
testRegex: tests/.*Test.js - 9 matches
testPathIgnorePatterns: \node_modules\ - 41 matches

Debug file attached.

Thanks in advance
jest_debug.txt

@henrikbjorn
Copy link

Same, it seems to only find my real module files, not the files in my __tests__ directory.

@ghost
Copy link

ghost commented Sep 1, 2016

Same, only works in v14.1.0

@cpojer
Copy link
Member

cpojer commented Sep 1, 2016

Can someone provide a repository that I can install on windows to test this? Seems like 15 works on windows but you have a configuration that isn't quite compatible.

@ManuelDeLeon
Copy link

Here's the repro: https://github.com/ManuelDeLeon/jest-issue-1551

It only has 2 files:

package.json

{
  "name": "jest-issue-1551",
  "version": "1.0.0",
  "scripts": {
    "test": "jest"
  },
  "devDependencies": {
    "jest-cli": "^15.0.0"
  },
  "jest": {
    "testRegex": "\\.test\\.js$",
    "testPathDirs": [
      "src"
    ]
  }
}

src\some.test.js

describe('Test', () => {
  it('works', () => {
    expect(true).toBe(true);
  });
});

With v14:

C:\MyFiles\React\repros\jest-issue-1551>npm test

> [email protected] test C:\MyFiles\React\repros\jest-issue-1551
> jest

Using Jest CLI v14.1.0, jasmine2, babel-jest
 PASS  src\some.test.js (0.73s)
1 test passed (1 total in 1 test suite, run time 1.706s)

With v15:

C:\MyFiles\React\repros\jest-issue-1551>npm test

> [email protected] test C:\MyFiles\React\repros\jest-issue-1551
> jest

No tests found
  1 file checked.
  testPathDirs: C:\MyFiles\React\repros\jest-issue-1551\src - 0 matches
  testRegex: \.test\.js$ - 1 match
  testPathIgnorePatterns: \\node_modules\\ - 1 match

@audetpascale
Copy link

audetpascale commented Sep 1, 2016

The dash in testPathDirs is the issue here.

@audetpascale
Copy link

audetpascale commented Sep 1, 2016

Duplicate: 1567 1568

@audetpascale
Copy link

From my ticket...

Bug

Version

Jest 15.1.0
Node v4.4.7
NPM 3.10.6
Windows 10

Current behavior

Since the update to Jest 15, no more tests are found.

Steps to reproduce

  • Reproducible on any project with Jest.

  • Add a dash in your path, e.g. C:\idea\myproject replaced to C:\idea\my-project

  • Then execute npm test.

    No tests found
    ...
    testPathDirs: C:\idea\my-project - 0 matches
    

Expected behavior

The tests are found.

Debug mode

Here is the relevant info...

  "testPathDirs": [
    "C:\\idea\\my-project"
  ]

The dash is not escaped.

Note

Probably related to this pull request...

@flarocca
Copy link

flarocca commented Sep 1, 2016

Is it resolved? I'm facing the same problem...

@cpojer
Copy link
Member

cpojer commented Sep 2, 2016

Thanks for the repros. @Daniel15 is our resident windows expert. We are hoping to have a fix for this sometime tomorrow. Please be patient, it's a bit hard sometimes to keep up.

@Daniel15
Copy link
Contributor

Daniel15 commented Sep 2, 2016

I'll try to take a look at this tonight. All the known issues should have been resolved by #1463, I'll need to investigate further and determine what broke.

Unfortunately we don't have automated builds on Windows yet. Currently, several of Jest's unit tests are broken on Windows. We're aiming to fix all those issues and enable an AppVeyor build (#1465) to more easily catch Windows-specific regressions in the future.

@Daniel15
Copy link
Contributor

Daniel15 commented Sep 2, 2016

I think @cpojer is right that #1574 should fix this. So far I've only been able to replicate the issue for folder names containing hyphens.

@cpojer
Copy link
Member

cpojer commented Sep 2, 2016

Published 15.1.1 with a fix. Sorry for the wait!

@flarocca
Copy link

flarocca commented Sep 2, 2016

Man, amazing job!!! It's working perfectly now.

1° Thor
2° God
@cpojer ;-)

Thanks for all!!!!

@cpojer
Copy link
Member

cpojer commented Sep 2, 2016

Hey, I didn't do anything! All credit goes to @insin who troubleshooted it and sent a PR and @Daniel15 who helped verify.

@cpojer cpojer closed this as completed Sep 2, 2016
@dskgry
Copy link
Author

dskgry commented Sep 2, 2016

Thanks. I love you so much that it hurts :)

@dylanparry
Copy link

I'm still getting this issue on 15.1.1, but there aren't any dashes in my path.

There are . characters in the path, but they don't seem to be the cause as replacing them with anything else makes no difference.

There are also spaces, and it seems like that might be the cause as when I move the project directory right down to C:\myprojectname it then begins to find the tests correctly, but won't find any when the directory is like C:\My Directory\myprojectname.

Is this related to the same bug, or should I file a new report?

@Daniel15
Copy link
Contributor

Daniel15 commented Sep 6, 2016

Hi @dylanparry! I'd suggest filing a new issue so we can look into it. I think we'll add some integration tests to test scenarios like this.

@dylanparry
Copy link

Thanks. I'll file a bug now.

@Xnave2
Copy link

Xnave2 commented Sep 10, 2016

Hi, I am now learning react and using react-scripts wich actually runs jest
I am having the same bug of "No tests found" and 0 matches.. tried to run by script {'test': 'jest'} and of course update to the latest version of jest (npm install --save-dev jest@^) and got 15.1.1
but still no test found. It's driving me crazy hope someone can help.

No tests found
7 files checked.
testPathDirs: C:\Users\User\Desktop\learning react\vode-client - 0 matches
testRegex: (/tests/.*|.(test|spec)).(js|jsx)$ - 2 matches
testPathIgnorePatterns: C:\Users\User\Desktop\learning react\vode-client(build|docs|node_modules)\ - 7 matches

@cpojer
Copy link
Member

cpojer commented Sep 11, 2016

It seems like there is also a bug with spaces in dir names on windows. See #1639 – we'll fix it in the next Jest release.

@jeffersoneagley
Copy link

jeffersoneagley commented Nov 19, 2017

Having the same issue running 21.2.1
I'm on windows 10.
+, space, and . are in the path.

@tedtang77
Copy link

I am having the same issue running 21.2.1 with windows

@thymikee
Copy link
Collaborator

@tedtang77 try v23, there have been couple of windows fixes since v21

@tedtang77
Copy link

It works on v23! Thanks very much

@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 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests