47

All my jest typescript tests fail in my travis pipeline throwing the following error:

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

This happened suddenly without me changing anything particular in the code. And locally everything works fine.

Any ideas what could be happening ?

Şivā SankĂr
  • 1,966
  • 1
  • 18
  • 34
FabienChn
  • 938
  • 10
  • 17

6 Answers6

58

That is a bug that came with node v11.11. You can downgrade to v11.10 or wait for the fix which facebook has already pushed (jest error in Node version over 11.11).

If your problem is TravisCI related then you can set a fixed version which works:

node_js:
  - "11.10.1"
Edgar
  • 6,022
  • 8
  • 33
  • 66
alknows
  • 1,972
  • 3
  • 22
  • 26
20

You can also upgrade your version of jest to 24.3.0 which has this issue fixed. I believe this is a more future proof solution than downgrading your node.

Miroslav Jonas
  • 5,407
  • 1
  • 27
  • 41
  • I upgraded to jest 24.3.1 and it did not work. Changed node version to 11.10.1 and it started working again – Nabuska Mar 08 '19 at 17:40
4

This was fixed for me by just upgrading node to v11.12.0

Kyler
  • 41
  • 2
2

For those of you who can't fix the problem with either of the above answers, try upgrading your jest to ^24.3.0 and downgrading the node version in your docker image of your client container. I used FROM node:11.10-alpine without downgrading the version of node TravisCI uses.

1

There were mainly two solutions for this problem

  • Upgrade your jest version to 24.3.0 ( which didn't worked for me)
  • Downgrade your node version to 11.10.1

I know that downgrading node version is not a good solution but for those who want to run your tests anyways can try it. By downgrading their node version from 11.11.1 to 11.10.1 Install package call "n" . This n package helps you to Interactively Manage Your Node.js Versions

npm install -g  n

After installing it you just run

sudo n 11.10.1

and your node version will get changed you can check the node version by running

node --version

And later can run there test

npm test

It worked for me I hope it will be helpful :)

Ishu Singh
  • 11
  • 1
1

if you use nvm (node version manager),

nvm install v11
nvm use v11
Aurora
  • 136
  • 1
  • 3