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

Newly created react app with typescript template crashing when running tests with coverage flag enabled #9593

Closed
PabloFNK opened this issue Sep 4, 2020 · 7 comments

Comments

@PabloFNK
Copy link

PabloFNK commented Sep 4, 2020

Describe the bug

Running on a greenfield project created with create-react-app and typescript template the tests with the coverage flag doesn't work. Running the test without coverage flag works fine.

Environment

Environment Info:

  current version of create-react-app: 3.4.1
  running from /Users/pperezdiez/.config/yarn/global/node_modules/create-react-app

  System:
    OS: macOS 10.15.5
    CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
  Binaries:
    Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
  Browsers:
    Chrome: 85.0.4183.83
    Firefox: 79.0
    Safari: 13.1.1
  npmPackages:
    react: ^16.13.1 => 16.13.1 
    react-dom: ^16.13.1 => 16.13.1 
    react-scripts: 3.4.3 => 3.4.3 
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

  1. yarn create react-app my-first-app --template typescript
  2. Add to package.json a script to run tests with coverage: "test:coverage": "react-scripts test -- --coverage --runInBand --watchAll=false",
  3. Run the coverage: yarn test:coverage

Same can be done without yarn. I am adding yarn as it is how I created it so it is consistent with the info above.

Expected behavior

The tests are run properly when the coverage flag is enabled

Actual behavior

It crashes like if it wasn't aware that it has to transpile typescript to run the tests.

Screenshot 2020-09-04 at 13 04 37
Screenshot 2020-09-04 at 13 04 52

@idrm
Copy link

idrm commented Sep 9, 2020

Could it be related to #9515 ?

@Cono52
Copy link

Cono52 commented Sep 10, 2020

I have a similar issue, but without typescript template.
Add coverage flag, and the first test just fails, nothing changed, fresh CRA project

This is probably more related to #9322

image

@stale
Copy link

stale bot commented Oct 12, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Oct 12, 2020
@PabloFNK
Copy link
Author

This is stale as there is no official answer but this is still happening.

@stale stale bot removed the stale label Oct 12, 2020
@chrkaatz
Copy link

Same for me

@stale
Copy link

stale bot commented Dec 25, 2020

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

@stale stale bot added the stale label Dec 25, 2020
@PabloFNK
Copy link
Author

PabloFNK commented Mar 8, 2021

I have detected that with react-scripts 4 this issue is solved, so if someone is still facing this I suggest to update. At least creating a project from scratch no longer fails when running tests with coverage flag.

@stale stale bot removed the stale label Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants