Kaiaya
Kaiaya

Reputation: 101

bash: jest: command not found

Honestly, I feel like I'm all over the place tryna figure out why this is happening so any suggestion/help would be appreciated

other "solutions" I've tried are: node_modules/jest/bin/jest reversestring/test.js --watch ./node_modules/.bin/jest steps/test.js --watch

note: revesersestring and steps were exercises I was trying to run jest on

My OS is MAC

Upvotes: 9

Views: 15624

Answers (3)

pbaranski
pbaranski

Reputation: 25062

I resolved my problem by using Jest Runner extension in VSC.

Upvotes: 0

okhobb
okhobb

Reputation: 878

Running:

npm install --save-dev jest-cli

Will put the jest command into the directory:

node_modules/.bin/

This directory is what is used to run commands via package.json

For example:

"scripts": {
  "test": "jest -i"
},

Will be runnable via:

npm run test

Or:

yarn test

Upvotes: 2

Mark
Mark

Reputation: 1679

The jest library must be installed globally. Otherwise you need to run it from the absolute path in your node_modules folder. The easiest way to run the jest command is to run an npm script. Like below:

npm test

you can install the jest-cli globally by running:

npm install -g jest-cli

Upvotes: 9

Related Questions