Issue running jest unit test - The term 'node_modules/jest/bin/jest.js' is not recognized

I am currently working on Module 2 of the Foundation Certificate course. I have got to the section where I need to write a framework for Unit tests and am being guided through the steps. When viewing my dependencies in the package.json file I couldnt see jest listed, and so i added this in myself directly to the file and then pushed it to Origin.

When i try to run the suggested command in powershell (terminal on VS Code), I get an error. What am I doing wrong?

1 Like

I’d suggest installing Jest globally with npm install -g jest

Then you can call jest in your command line (don’t forget to restart your terminal window after installation).

3 Likes

Thanks Mark. I had run the suggested command line of β€œnpm install -save @testing-library/react jest nock jest-junit” to install jest among others previously, but have now tried your suggestion given in your reply. This is the list of dependencies that I have in my package.json file:

image

Still getting the same error when i try to run that node/modules line in a new Terminal.

How do i β€œcall jest in my command line”?

1 Like

I have managed to sort this issue out myself. I decided to remove my cloned repo and start all over again. This time I have been successful. I think there may have been an issue with the folder as I had two copies of the repo on my local machine and I think i was running my command lines against the wrong one.

Apologies for taking up any of your time.

1 Like

What is the certification course? any links plz

Thanks
I finished ISTQB Certification, and looking for manual roles.
This at 599, seems pricey.