# Stuck on 2.2.3 - Running Jest Unit Test

**URL:** <https://club.ministryoftesting.com/t/stuck-on-2-2-3-running-jest-unit-test/74422>\
**Category:** Discussions\
**Tags:** learning, automation, mot-fcta\
**Created:** [27 February 2024 18:03 UTC](https://club.ministryoftesting.com/t/stuck-on-2-2-3-running-jest-unit-test/74422 "2024-02-27T18:03:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![philippa](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/philippa/32/14081_2.png) [@philippa](https://club.ministryoftesting.com/u/philippa)\
**Post date:** [27 February 2024 18:03 UTC](https://club.ministryoftesting.com/t/stuck-on-2-2-3-running-jest-unit-test/74422/1 "2024-02-27T18:03:08Z")

</div>

I am following module 2.2.3 on the Foundation Certificate course and get to this bit where it says to run the test using the code “node\_modules/jest/bin/jest.js src/ **tests** /exampleComponent.test.js”

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ministryoftesting/original/2X/0/0658724f1140eb064360a6286acefa9d30369e48.png)

When i open the terminal and add that code in, then all it does is open up the exampleComponent.test.js file and place the cursor at the start of that file. I cannot see any test run information anywhere.

What am I doing wrong?

Here is a screenshot of my VS Code with terminal once I have added that code:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ministryoftesting/original/2X/8/8809c6944fb523f4199bb409f6f50479832ad7d7.png)

---

<div class="post-metadata">

**Author:** ![mwinteringham](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/mwinteringham/32/9023_2.png) [@mwinteringham](https://club.ministryoftesting.com/u/mwinteringham)\
**Post date:** [27 February 2024 20:38 UTC](https://club.ministryoftesting.com/t/stuck-on-2-2-3-running-jest-unit-test/74422/2 "2024-02-27T20:38:34Z")

</div>

That is odd behaviour. Not sure what is going on there exactly.

One suggestion would be to try installing jest globally with `npm install -g jest` and then attempt to run:

```auto
jest src/ __tests__ /exampleComponent.test.js

```

Try typing it in as well so that no hidden characters are appearing.

---

<div class="post-metadata">

**Author:** ![philippa](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/philippa/32/14081_2.png) [@philippa](https://club.ministryoftesting.com/u/philippa)\
**Post date:** [28 February 2024 10:18 UTC](https://club.ministryoftesting.com/t/stuck-on-2-2-3-running-jest-unit-test/74422/3 "2024-02-28T10:18:43Z")

</div>

Thanks Mark. It turned out to be connected with my execution policy. After a bit of reading about that, I found that I had an undefined signature, which meant that it wouldnt let me run any scripts. I then corrected the signature for my currentuser and it has now let me run the test using your suggested code above.

More info can be found here: [about Execution Policies - PowerShell | Microsoft Learn](https://learn.microsoft.com/en-gb/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.4)
