I have a pipeline in GitHub Actions and it is suggesting that it cannot find Jest despite it working locally.
If I run npm run unit-tests locally it works fine, but in the CI I get the following error:
> jest --group=unit --coverage --verbose
/tmp/unit-tests-2f311f40.sh: 1: jest: not found
name: staging-pipeline
on:
push:
tags:
- 'v*-staging'
env:
CI: true
NODE_ENV: production
jobs:
unit-test:
name: unit-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Unit Tests
run: |
npm install
npm run unit-tests
{
"name": "app",
"version": "1.0.0",
"description": "app",
"main": "",
"scripts": {
"ts-node": "ts-node",
"test": "jest",
"unit-tests": "jest --group=unit --coverage --verbose",
"prisma-generate": "npx prisma generate && npm install @prisma/client"
},
"dependencies": {
"@prisma/client": "^4.3.1",
"axios": "^0.27.2",
"axios-retry": "^3.3.1",
"dotenv": "^16.0.2",
"mongodb": "^4.9.1",
"qs": "^6.11.0",
"winston": "^3.8.1",
"zod": "^3.18.0"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.102",
"@types/jest": "^29.0.0",
"@types/node": "^18.7.15",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"esbuild": "^0.15.7",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^28.1.3",
"jest-mock-extended": "^2.0.7",
"jest-runner-groups": "^2.2.0",
"json-schema-to-ts": "^2.5.5",
"prettier": "2.7.1",
"prisma": "^4.3.1",
"ts-jest": "^28.0.8",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.1.0",
"typescript": "^4.8.2"
},
"author": "",
"license": "MIT"
}