Skip to content

npm test fails for default skeleton project #6092

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

Closed
makareth opened this issue Dec 26, 2018 · 4 comments
Closed

npm test fails for default skeleton project #6092

makareth opened this issue Dec 26, 2018 · 4 comments
Labels

Comments

@makareth
Copy link

Is this a bug report?

Yes, this is a bug regarding the default skeleton testing capability not working.
This seems to differ from github issues #4787 and #5210.

Did you try recovering your dependencies?

Yes, removed :
* node_modules
* package-lock.json
* (there was no yarn file, I'm using npm only)

Then :

    npm install -g npm@latest
    npm install

This installed npm v6.5.0.
But npm test yield same result than before.

npm --version
6.5.0

Which terms did you search for in User Guide?

npm test
test
package.json

Environment

Environment Info:

  System:
    OS: Linux 4.15 Ubuntu 16.04.5 LTS (Xenial Xerus)
    CPU: x64 Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
  Binaries:
    Node: 10.14.2 - ~/node-v10.14.2-linux-x64/bin/node
    npm: 6.5.0 - ~/node-v10.14.2-linux-x64/bin/npm
  Browsers:
    Chrome: 70.0.3538.102
    Firefox: 64.0
  npmPackages:
    react: ^16.7.0 => 16.7.0 
    react-dom: ^16.7.0 => 16.7.0 
    react-scripts: 2.1.2 => 2.1.2 
  npmGlobalPackages:
    create-react-app: 2.1.1

Steps to Reproduce

mkdir kk
cd kk
create-react-app my-react-app
cd my-react-app/
npm test

Expected Behavior

The expected result would be to have all tests succeeding. Here, looks like the tests can't be executed because the package.json file in ~/kkk/my-react-app is not found.

Actual Behavior

The result is :

 FAIL  src/App.test.js
  ● Test suite failed to run

    Cannot find module '/home/scoulibaly/package.json'

      at getBabelRC (node_modules/babel-jest/build/index.js:117:41)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.341s
Ran all test suites.

Watch Usage: Press w to show more.

### Reproducible Demo
The default project of create-react-app reproduces the issue.
@mrmckeb
Copy link
Contributor

mrmckeb commented Jan 4, 2019

Hi @makareth, this is a strange issue. Can you confirm how you installed this project?

I'd also recommend not having a globally installed create-react-app and instead using either yarn create react-app or npx create-react-app to create a project.

@makareth
Copy link
Author

makareth commented Jan 9, 2019

@mrmckeb Yes, I confirm I installed the project in a brand new directory with create-react-app.
I tried your suggestion :

  mkdir kkk
   cd kkk
   npx create-react-app app
   cd app
   npm test

The very same output is yield :

 FAIL  src/App.test.js
  ● Test suite failed to run

    Cannot find module '/home/scoulibaly/package.json'

      at getBabelRC (node_modules/babel-jest/build/index.js:117:41)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.028s
Ran all test suites.

@stale
Copy link

stale bot commented Feb 8, 2019

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 Feb 8, 2019
@stale
Copy link

stale bot commented Feb 13, 2019

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

@stale stale bot closed this as completed Feb 13, 2019
@lock lock bot locked and limited conversation to collaborators Feb 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants