Skip to content

path sep replacement went wrong on Windows10 #6576

@HadesTang

Description

@HadesTang

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions