How to change CLI arguments of Jest Runner using VSCode

Viewed 260

I'm switching from MacOS to Windows WSL2 Ubuntu subsystem.

I want to run a basic Jest test from VSCode, with the JestRunner plugin :

When I click on the "Run" button, it opens a terminal on VSCode (WSL not PowerShell), but it automatically launches this command

vincent@LAPTOP-xxxxx:~/Development/Labomaton/packages/api/node_modules$ node "//wsl$/Ubuntu-20.04/home/vincent/Development/Labomaton/packages/api/node_modules/jest/bin/jest.js" 
"//wsl$/Ubuntu-20.04/home/vincent/Development/Labomaton/packages/api/src/user/infrastructure/rest/pipes/create-user-validation.spec.ts"
 -t "Register user into Labomaton missing firstname"
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/wsl$/Ubuntu-20.04/home/vincent/Development/Labomaton/packages/api/node_modules/jest/bin/jest.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

So I try to run the same command with the correct path to this node module:

vincent@LAPTOP-xxxxx:~/Development/Labomaton/packages/api/node_modules$ node "/home/vincent/Development/Labomaton/packages/api/node_modules/jest/bin/jest.js"
 "/home/vincent/Development/Labomaton/packages/api/src/user/infrastructure/rest/pipes/create-user-validation.spec.ts"
 -t "Register user into Labomaton missing firstname"
 PASS  ../src/user/infrastructure/rest/pipes/create-user-validation.spec.ts
  Register user into Labomaton
    ✓ missing firstname (5 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.313 s

My question is: how to change the path as an argument to this VSCode JestRunner feature?

0 Answers
Related