{"id":663,"hash":"46272a123dbedce42307d8cdabd003f7482ef5ff5b24adcdfccc326d65cdbfae","pattern":"&#39;command not found: jest&#39;","full_message":"I have a test file like so: (I am using create-react-app)\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './components/Calculator';\n\nimport { getAction, getResult } from './actions/'\n\nimport {shallow} from 'enzyme';\nimport toJson from 'enzyme-to-json';\n\nimport Enzyme from 'enzyme';\nimport Adapter from 'enzyme-adapter-react-16';\n\nEnzyme.configure({ adapter: new Adapter() });\n\nit('renders without crashing', () => {\n  const wrapper = shallow(<App />)\n  expect(toJson(wrapper)).toMatchSnapshot();\n});\n\nit('displays the choosen operator', () => {\n  const action = {\n      type: 'GET_ACTION',\n      operator: '+'\n    };\n  expect(getAction(\"+\")).toEqual(action)\n})\n\nit('displays the typed digit', () => {\n  const action = {\n    type: 'GET_RESULT',\n    n: 3\n  };\n  expect(getResult(3)).toEqual(action);\n})\n\nit('checks that the clickevent for getNumber is called',() => {\n  const clickEvent = jest.fn();\n  const p = shallow(<p data-n=\"1\" onClick={clickEvent}>1</p>)\n  p.simulate('click')\n  expect(clickEvent).toBeCalled();\n})\n\nand a package.json:\n\n{\n  \"name\": \"my-app\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"dependencies\": {\n    \"react\": \"^16.2.0\",\n    \"react-dom\": \"^16.2.0\",\n    \"react-scripts\": \"1.1.1\"\n  },\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n    // \"test\": \"react-scripts test --env=jsdom\",\n    \"test\": \"jest\",\n    \"eject\": \"react-scripts eject\"\n  },\n  \"devDependencies\": {\n    \"enzyme\": \"^3.3.0\",\n    \"enzyme-adapter-react-16\": \"^1.1.1\",\n    \"enzyme-to-json\": \"^3.3.3\",\n    \"jest\": \"^22.4.3\"\n  }\n}\n\nwhen I run jest --updateSnapshot I get:\n\ncommand not found: jest\n\nbut jest is installed.","ecosystem":"npm","package_name":"reactjs","package_version":null,"solution":"Jest is installed, but is likely in your ./node_modules/.bin directory.  You can append that to your command ./node_modules/.bin/jest --updateSnapshot.  Since you already have jest as a scripts command in your package.json you can also run it with npm test -- --updateSnapshot.  npm automatically adds ./node_modules/.bin to your path.\n\nupdate: Newer versions of yarn will resolve node module bin scripts, so you can also just run yarn jest {cmd} and it should work.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/50138532/command-not-found-jest","votes":123,"created_at":"2026-04-19T04:51:27.267296+00:00","updated_at":"2026-04-19T04:51:27.267296+00:00"}