Skip to content

react-scripts test not working with hidden directories (prefixed with .) #7660

Open
@nicojs

Description

@nicojs

Describe the bug

When one of the directories in your location is prefixed with a . the react-scripts test isn't working. You can see it when running npm test and then choose to run all. The glob expression used seems to be invalid:

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\z\.my-app
  4 files checked.
  testMatch: C:/z\.my-app/src/**/__tests__/**/*.{js,jsx,ts,tsx}, C:/z\.my-app/src/**/*.{spec,test}.{js,jsx,ts,tsx} - 0 matches
  testPathIgnorePatterns: \\node_modules\\ - 4 matches
  testRegex:  - 0 matches
Pattern:  - 0 matches

Did you try recovering your dependencies?

Simple repro steps for a new project below.

Which terms did you search for in User Guide?

n/a

Environment

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: 12.9.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.12.3 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
    Internet Explorer: 11.0.17134.1
  npmPackages:
    react: ^16.9.0 => 16.9.0
    react-dom: ^16.9.0 => 16.9.0
    react-scripts: 3.1.1 => 3.1.1
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

  1. npx create-react-app my-app
  2. mv my-app .my-app
  3. cd .my-app
  4. npm test

Expected behavior

I would expect the 1 test to run.

Actual behavior

However, no tests are found.

Reproducible demo

Please copy and paste:

npx create-react-app my-app
mv my-app .my-app
cd .my-app
npm test

Select a to run all tests.

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