TravisCI build continues to fail even after changing alpine version So I ran my Docker build with TravisCI and I got a failure like so:

FAIL src/App.test.js
  ● Test suite failed to run
    TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#&lt;process&gt;'
      at exports.default (node_modules/jest-util/build/create_process_object.js:15:34)


I did not think that this App.test.js file would give me problems after I removed the logic from within the it block like so:

import React from "react";
import ReactDOM from "react-dom";
import App from "./App";

it("renders without crashing", () =&gt; {});


I thought the issue may have been the latest release of node because I saw others have similar error messages, so I changed my version like so:

FROM node:10.15-alpine as builder OR FROM node:10.15-alpine as I have various Dockerfiles for each service I am building as this is a multi-container project.

That change I made did not resolve the issue, TravisCI continues to fail my build with the same exact error, what gives here?

I thought perhaps the issue would be a version of Jest mismatch, but I have not installed any version of Jest, this is my package.json file inside my client/src/App.test.js:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.8.3",
    "react-dom": "^16.8.3",
    "react-scripts": "2.1.5",
    "react-router-dom": "4.3.1",
    "axios": "0.18.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    "&gt;0.2%",
    "not dead",
    "not ie &lt;= 11",
    "not op_mini all"
  ]
}


None of the solutions above have helped me. You cannot upgrade Jest because react-scripts comes with version 23.x so you are just adding on top of what react-scripts would already have. You cannot upgrade react-scripts so that it will have jest@24 because the latest version has jest@23.

Changing to v11.10.1 does not help either and within my Dockerfile I have tried changing the 'FROM' in my Dockerfile to FROM node:10.15-alpine and that has not helped.

When I tested it in this manner:

docker run -it --rm -v $(PWD):$(PWD) -w $(PWD) node:10.15-alpine npm test

it passed!

 PASS  src/App.test.js (10.163s)

  ✓ renders without crashing (5ms)


But it does not pass in TravisCI

This is my Dockerfile for my client/src directory:

FROM node:10.15-alpine as builder
WORKDIR '/app'
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

FROM nginx
EXPOSE 3000
COPY --from=builder /app/build /usr/share/nginx/html


I even tried changing my .travis.yml file to this:

- docker run -it --rm -v myproject/react-test node:10.15-alpine npm test -- --coverage,

when it was originally this:

script:
  - docker run myproject/react-test npm test -- --coverage


Absolutely nothing appears to be working here.
You cannot rely on FROM node:10.15-alpine alone to fix this. I had to go with the fix from the facebook team. So if anyone else did not get a fix from modifying your Dockerfile to node:10.15-alpine, go to your package.json file and change react-scripts to the following facebook fix:

"react-scripts": "3.0.0-next.b0cbf2ca"

Then go ahead and remove your node_modules/ folder via rm -rf node_modules and then run npm install, check your jest-util file, it should now have an output like this:

└─┬ react-scripts@3.0.0-next.b0cbf2ca
  ├─┬ babel-jest@24.5.0
  │ └─┬ @jest/transform@24.5.0
  │   ├─┬ jest-haste-map@24.5.0
  │   │ └── jest-util@24.5.0  deduped
  │   └── jest-util@24.5.0
  └─┬ jest@24.5.0
    └─┬ jest-cli@24.5.0
      ├─┬ @jest/core@24.5.0
      │ ├─┬ @jest/reporters@24.5.0
      │ │ └── jest-util@24.5.0  deduped
      │ ├─┬ jest-runner@24.5.0
      │ │ └── jest-util@24.5.0  deduped
      │ ├─┬ jest-runtime@24.5.0
      │ │ └── jest-util@24.5.0  deduped
      │ ├── jest-util@24.5.0  deduped
      │ └─┬ jest-watcher@24.5.0
      │   └── jest-util@24.5.0  deduped
      ├─┬ jest-config@24.5.0
      │ ├─┬ jest-environment-jsdom@24.5.0
      │ │ └── jest-util@24.5.0  deduped
      │ ├─┬ jest-environment-node@24.5.0
      │ │ └── jest-util@24.5.0  deduped
      │ ├─┬ jest-jasmine2@24.5.0
      │ │ ├─┬ jest-each@24.5.0
      │ │ │ └── jest-util@24.5.0  deduped
      │ │ └── jest-util@24.5.0  deduped
      │ └── jest-util@24.5.0  deduped
      └── jest-util@24.5.0  deduped


You should be good to run TravisCI build now. The issue is the react-scripts version 2.1.8 is conflicting with new version of Node. Suffered through this all day long, grateful to the facebook team for getting back to me. 

For reference: https://github.com/facebook/create-react-app/issues/6475