Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vscode jest extension doesn't work properly

I'm working with VSCode and installed the extension: "Jest" for better jest-testing-enviroment.

In the extension's instruction I saw we get a nice intellisense support for Jest's commands.

The Problem:

  1. I dont get "Jest" icon on the bottom bar, which means the ext doesnt work properly.

  2. I still dont get the intellisense support for jest's commands

My Question:

Did anyone had this issue and find the way to configure it properly ?

like image 544
ueeieiie Avatar asked Feb 20 '18 14:02

ueeieiie


People also ask

Why my VS Code extension is not working?

The solution was to go to Windows PowerShell and open Visual Studio Code, then go to the extensions and restart the Remote - WSL extension, and go back to WSL. It then started working immediately.


Video Answer


2 Answers

Solution:

Once I understood my folder structure was the reason for the extension not to work properly, I started using VSCode's Workspaces.

Explanation:

When using Workspaces you can have multiple projects in one folder. Each will be count as a root project. The Workspace allows you to have multiple root projects in the same folder (which actually solved my problem).

When working with Jest without setting a jest.config.js file, you get your rootDir to its default (which is the folder where the package.json is in).

P.S.

From what I experienced till now, vscode-jest extension is not so stable and still has some bugs. So in my case, I decided to disable it for the meanwhile.

like image 179
ueeieiie Avatar answered Nov 15 '22 08:11

ueeieiie


Highly recommend using the jest runner extension instead.

Demo:

]

like image 35
joe Avatar answered Nov 15 '22 10:11

joe