I'm using heroku CI to run tests every time code is pushed to any branch in my repository. Each time code is pushed, heroku CI runs a test setup. The problem I'm facing is the test setup fails with a very ambiguous error during the creating optimized production build
phase.
Some details:
App is built with ionic framework.
app.json
{
"buildpacks": [
{"url": "https://github.com/heroku/heroku-buildpack-nodejs#latest"},
{"url": "https://buildpack-registry.s3.amazonaws.com/buildpacks/mars/create-react-app.tgz"}
],
"environments": {
"test": {
"scripts": {
"test": "npm test"
}
}
}
}
package.json
{
"name": "redacted",
"version": "0.0.1",
"private": true,
"dependencies": {
"@bugsnag/js": "^7.6.0",
"@bugsnag/plugin-react": "^7.6.0",
"@stripe/react-stripe-js": "^1.4.0",
"@stripe/stripe-js": "^1.14.0",
"@twilio/conversations": "^1.1.0",
"@types/react-timeago": "^4.1.2",
"amplitude-js": "^8.6.0",
"autosize": "^4.0.2",
"awesome-debounce-promise": "^2.1.0",
"axios": "^0.24.0",
"axios-case-converter": "^0.9.0",
"classnames": "^2.2.6",
"ionicons": "^5.0.0",
"react": "^16.13.0",
"react-async-hook": "^3.6.2",
"react-contenteditable": "^3.3.5",
"react-dom": "^16.13.0",
"react-hook-form": "^6.8.6",
"react-image-crop": "^8.6.6",
"react-responsive-carousel": "^3.2.19",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.4",
"react-timeago": "^4.4.0",
"react-use-intercom": "^1.4.0",
"react-virtualized": "^9.22.2",
"react-virtualized-auto-sizer": "^1.0.2",
"react-virtualized-listview": "^0.1.7",
"react-window": "^1.8.5",
"react-window-infinite-loader": "^1.0.5",
"sanitize-html": "^2.4.0",
"stream-chat": "^4.2.0",
"stream-chat-react": "^6.11.0",
"ts-debounce": "^2.0.1",
"twilio-chat": "^4.0.0",
"typescript": "^4.2.3",
"use-constant": "^1.0.0",
"uuid": "^8.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll=false",
"eject": "react-scripts eject",
"lint": "eslint . --ext .tsx"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version",
">0.3%",
"not ie 11",
"not dead",
"not op_mini all"
]
},
"devDependencies": {
"@capacitor/cli": "2.4.0",
"@capacitor/core": "2.4.0",
"@capacitor/ios": "^2.4.0",
"@ionic-native/http": "^5.27.0",
"@ionic/eslint-plugin": "0.0.1",
"@ionic/react": "^5.0.7",
"@ionic/react-router": "^5.0.7",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^8.0.3",
"@types/amplitude-js": "^8.0.1",
"@types/autosize": "^3.0.7",
"@types/classnames": "^2.2.10",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^24.0.25",
"@types/node": "^12.12.24",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"@types/react-image-crop": "^8.1.2",
"@types/react-router": "^5.1.4",
"@types/react-router-dom": "^5.1.3",
"@types/sanitize-html": "^1.27.0",
"@types/twilio": "^2.11.0",
"@types/uuid": "^8.3.1",
"cordova-plugin-advanced-http": "^3.0.0",
"cordova-plugin-file": "^6.0.2",
"eslint-plugin-react": "^7.21.2",
"eslint-plugin-react-hooks": "^4.2.0",
"mutationobserver-shim": "^0.3.7",
"node-sass": "^4.14.1"
},
"description": "redacted"
}
**heroku test setup logs**
-----> Building on the Heroku-20 stack
-----> Fetching https://github.com/heroku/heroku-buildpack-nodejs#latest buildpack...
buildpack downloaded
-----> Fetching https://buildpack-registry.s3.amazonaws.com/buildpacks/mars/create-react-app.tgz buildpack...
buildpack downloaded
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_PRODUCTION=false
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=test
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.18.2...
Using default npm version: 6.14.15
-----> Installing dependencies
Installing node modules
> core-js@2.6.11 postinstall /app/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> fsevents@1.2.13 install /app/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> fsevents@1.2.13 install /app/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> core-js@3.7.0 postinstall /app/node_modules/react-app-polyfill/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> fsevents@1.2.13 install /app/node_modules/jest-haste-map/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> core-js-pure@3.7.0 postinstall /app/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
> core-js@3.7.0 postinstall /app/node_modules/react-image-crop/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> node-sass@4.14.1 install /app/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-83_binding.node
Download complete
Binary saved to /app/node_modules/node-sass/vendor/linux-x64-83/binding.node
Caching binary to /tmp/npmcache.oHBmq/_cacache/node-sass/4.14.1/linux-x64-83_binding.node
> node-sass@4.14.1 postinstall /app/node_modules/node-sass
> node scripts/build.js
Binary found at /app/node_modules/node-sass/vendor/linux-x64-83/binding.node
Testing binary
Binary is fine
added 2036 packages in 48.686s
-----> Build
Running build
> redacted@0.0.1 build /app
> react-scripts build
Creating an optimized production build...
..Terminated
I have no issues deploying the app without enabling heroku CI. Here's my profile
for reference
Procfile
web: bin/boot
How can I get the test setup to run successfully?