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

I have a React app that uses a Node.js express server for the API endpoints with MongoDB. The create-react-app starter project comes preconfigured with jest as the testing framework so I’m using that for the API endpoint testing.

Running the tests on my local development environment works fine and running in a docker container that I’m running locally also works fine.

Travis fails with the following error:

 FAIL  src/server/api/users.test.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)

Here is the build log:
https://travis-ci.com/jpvanoosten/learn/jobs/182875251

Any ideas why this is occurring?

2 Likes

Same here, all my js projects builds are failing. it happens when running jest. :frowning:

has there been any update in the images used to build lately?

my travis.yml is basically doing this:

os: osx
language: node_js
node_js:
  - node
script:
  - yarn test:cov

link to build

running test:cov ( test:cov": “jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js”). Locally will succeed in my case so seems to be really related to the environment on the CI.

@kanekotic In your case, your builds were passing 7 days ago. Comparing your pass/fail logs the only difference I can see is the branch that is being built.

I suspect that something subtle has changed with the container where the tests are running that is causing the issue (not in your or my source code).

1 Like

Try restarting a previously passing build, for example, this one. If it fails now, an underlying dependency changed and is now causing the problem. Comparing https://travis-ci.org/kanekotic/tellojs/builds/499692965 and https://travis-ci.org/kanekotic/tellojs/builds/503136713, One obvious change is the updated Node.js version (from 11.10 to 11.11).

1 Like

@BanzaiMan I’ve restarted the build of a previously passing build and it now fails with the same error:

 FAIL  src/App.test.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)

I’ve updated my .travis.yml file to target NodeJS 10.15.3 instead of just using “node” as the version:

language: node_js
node_js:
  - "10.15.3"

And this seems to solve the previous issue with the TypeError that was occurring. (of course, my tests are still failing… but at least now they are failing for different reasons).

Thanks for your help!

2 Likes

thanks a lot for the replies.

I have found also another solution as per the problem seems to be an incompatibility in between node and jest.

Upgrading jest to the latest version (24.3.1) did solve it for me also.

This fixed the same problem! Thanks!