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

path sep replacement went wrong on Windows10 #6576

Closed
HadesTang opened this issue Jun 29, 2018 · 10 comments
Closed

path sep replacement went wrong on Windows10 #6576

HadesTang opened this issue Jun 29, 2018 · 10 comments
Labels

Comments

@HadesTang
Copy link

HadesTang commented Jun 29, 2018

🐛 Bug Report

Windows 10
Jest version 23.1.0

When I run jest in react source code, It always consoles like this
image

Jest cannot find any test file.

It seems that something went wrong with replacePosixSep function in jest-config\build\normalize.js.

const replacePosixSep = pattern => {
    if ((_path || _load_path()).default.sep === '/') {
      return pattern;
    }
    return pattern.replace(/\//g, '\\\\');
 };

When i change the regex expression to /\\/g, It went well and test file can be matched.

Is there anything to do with path.sep? Because path.sep is '\\' on my computer.

To Reproduce

debug test case of react using vscode.

Expected behavior

test files should be found.

Link to repl or repo

repo

@HadesTang HadesTang changed the title path sep replacement went wrong on Window10 path sep replacement went wrong on Windows10 Jun 29, 2018
@SimenB
Copy link
Member

SimenB commented Jun 29, 2018

Is this fixed by #6523?

@marisev
Copy link

marisev commented Jul 2, 2018

We're experiencing the same issue

@massimonewsuk
Copy link

@SimenB when will the fix for this be released to npm? Jest was working fine for me on Windows until I deleted my node_modules folder, re-installed, and now I'm having the same issue above (no test files found)

@SimenB
Copy link
Member

SimenB commented Jul 3, 2018

#6523 will hopefully be released tonight

@jgoz
Copy link

jgoz commented Jul 5, 2018

@SimenB This issue is still present in 23.3.0. It appears to be caused by specifying testMatch entries that include one or more * characters. E.g.:

testMatch: [
  "<rootDir>/path/to/my.tests.js", // will match properly
  "<rootDir>/path/to/*.tests.js" // will NOT match any files
]

I can publish a test repo if that would help.

@jgoz
Copy link

jgoz commented Jul 5, 2018

This may be related to a recent micromatch upgrade: https://github.com/facebook/jest/pull/6400/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R54.

@stdavis
Copy link
Contributor

stdavis commented Jan 8, 2021

I was unable to reproduce this bug at 26.6.3 running windows server.
image

Here's my repro: https://github.com/stdavis/repros/tree/main/jest-6576/26.6.3

I believe that this bug may be fixed.

@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 14 days.

@github-actions github-actions bot added the Stale label Feb 25, 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 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants