Skip to content

testMatch on Windows #7914

@artola

Description

@artola

🐛 Bug Report

The following testMatch works on unix systems while does not on Windows machines. It is required to narrow the folders where to look for tests.

  testMatch: [
    '<rootDir>/src/**/?(*.)+(spec|test).(ts|tsx|mjs|js|jsx)',
  ],

Error on Windows:

  636 files checked.
  testMatch: C:/Users/IEUser/Fusion-UI/packages/infodesk/src/**\?(*.)+(spec|test).(ts|tsx|mjs|js|jsx) - 0 matches
  testPathIgnorePatterns: \\node_modules\\ - 636 matches
  testRegex:  - 636 matches
Pattern:  - 0 matches
error Command failed with exit code 1.

To Reproduce

Set a testMatch that starts with <rootDir>/src/... in place of the default **/*/....
See in the error message src/**\?(*.) here the / was replaced by \ and it is a lonely case.

Expected behavior

testMatch should work cross OS as in v23.

Link to repl or repo (highly encouraged)

this repro work in v22 while fails in v24 with Windows: https://repl.it/@artola/jest-bug

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14.3
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
  Binaries:
    Node: 11.9.0 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.5.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.1.0 => 24.1.0 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions