javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Error when running `npm test` or `npm run lint-test`

Open mainangethe opened this issue 7 years ago • 10 comments

I recently completed the Is Leap for Javascript.

  • I tried to run my tests with the command javascript npm test .
  • I went to the link provided by the CLI.
  • Expected: to see the results of my unit tests,
  • Actual: I got a Type Error.

cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object

Here's my "exercism debug":

**** Debug Information ****
Exercism CLI Version: 2.3.0
Exercism CLI Latest Release: 2.3.0
OS/Architecture: ubuntu, x64
Build OS/Architecture /
Home Dir: /Users/ngethe
Config file: /Users/ngethe/.exercism.json
API Key: *******
Exercises Directory: /Users/ngethe/exercism/javascript
> [email protected] test /home/ngethe/exercism/javascript/leap
> jest --no-cache ./*

**ERROR MESSAGE**
 FAIL  ./leap.spec.js
  ● Test suite failed to run

    TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<process>'

      at exports.default (node_modules/jest-util/build/create_process_object.js:15:34)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        0.444s
Ran all test suites matching /.\/README.md|.\/isLeap.js|.\/leap.spec.js|.\/node_modules|.\/package-lock.json|.\/package.json/i.

mainangethe avatar Mar 10 '19 06:03 mainangethe

tiny-error-screenshot

mainangethe avatar Mar 10 '19 06:03 mainangethe

This is an issue with Node v11.11 - https://github.com/facebook/create-react-app/issues/6591 For now there is no fix apart from downgrading node version.

tejasbubane avatar Mar 10 '19 09:03 tejasbubane

The project does not seem to use create-react-app. The following was resolved in jest: Facebook/jest#8050

If you use the version of jest and Babel-jest at v24.2.0-alpha.0 or later, you can resolve it. The latest version of best is v24.3.1. 😄

micalgenus avatar Mar 11 '19 07:03 micalgenus

@micalgenus Yes. This project does not use create-react-app and the issue was in Jest. I just happened to find that issue in create-react-app repo and used that issue link.

Alright so we need to update Jest. I tried doing the same after Jest 24 released recently and ran into all sorts of weird issues due to babel 7 (ref) I will give it a try again today.

tejasbubane avatar Mar 11 '19 10:03 tejasbubane

@micalgenus - I tried installing jest and babel-jest @ v24.2.0-alpha.0

And still getting an error. Now it's saying Cannot find module './leap' from 'leap.spec.js' tiny-npm-jest- -babel-v24 2-failing-16032019

mainangethe avatar Mar 16 '19 05:03 mainangethe

And are you certain there is a leap.js file in that directory? Normally you'll have to create this file and write the code in there.

SleeplessByte avatar Mar 16 '19 16:03 SleeplessByte

Resolved in Node 11.12

SleeplessByte avatar Mar 25 '19 19:03 SleeplessByte

@mainangethe Please fetch new version of the exercise and try again. Reopen this issue if you are still seeing the error. Thanks!

tejasbubane avatar Mar 25 '19 20:03 tejasbubane

npm run build chromium tests/testsuite.html npm run lint

caledrummond90 avatar Dec 16 '20 17:12 caledrummond90

@caledrummond90 I don't know why you posted this in this issue, but there is no build script in exercism/javascript, and no testsuite.html.

SleeplessByte avatar Dec 16 '20 17:12 SleeplessByte