Skip to content

Tests won't run if the project's root path contains parentheses #3404

@rimunroe

Description

@rimunroe

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Yes

Which terms did you search for in User Guide?

  • path
  • parens
  • parentheses
  • testMatch

Environment

  1. node -v: v6.10.3
  2. npm -v: v3.10.10
  3. yarn --version (if you use Yarn): N/A
  4. npm ls react-scripts (if you haven’t ejected): react-scripts@1.0.16

Then, specify:

  1. Operating system: macOS 10.12.6
  2. Browser and version (if relevant): N/A

Steps to Reproduce

  1. Create a directory with parentheses in the name: mkdir with-\(parens\)
  2. Navigate to that directory: cd with-\(parens\)
  3. Create a new app using create-react-app: create-react-app parens
  4. Go into the newly created my-app directory: cd parens
  5. Install dependencies: npm install
  6. Run tests: npm test
  7. You should see a prompt that says "No tests found related to files changed since last commit."
  8. Press "a" at the prompt to run all the tests.

Expected Behavior

The tests in src/app.test.js should be run.

Actual Behavior

A message about no tests being found will be shown.

image

Reproducible Demo

https://github.com/rimunroe/create-react-app-parens-in-test-path

It looks like the parentheses in the path that make up the <rootDir> later passed to Jest's testMatch option by create-react-app's config are being interpreted by Jest as grouping characters. I've filed this as an issue with Jest jestjs/jest#4838 as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions