firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
265 stars 124 forks source link

Not able to add Node Options --experimental-vm-modules in debug #217

Closed selvakumar-invicara closed 2 years ago

selvakumar-invicara commented 3 years ago

We follow ESM, so to make jest to be work I used below command,

node --experimental-vm-modules node_modules/.bin/jest

I have given this command in jestrunner.jestCommand to make jest runner to work for RUN. But It doesn't work for debug and never seeing any options pass this argument. If I add it in debugOptions then it append it as below

/usr/local/bin/node ./node_modules/.bin/jest --experimental-vm-modules

which gives an error as the argument should be before jest.

Is there any way to solve this problem

adamraine commented 3 years ago

I've tried to get this work by putting this in my settings.json:

"jestrunner.debugOptions": {
    "runtimeArgs": "--experimental-vm-modules"
},

Unfortunately, the flag is not injected correctly. It adds a space in between each character in the flag:

/path/to/node - - e x p e r i m e n t a l - v m - m o d u l e s ./node_modules/.bin/jest

In case it's relevant, I am using zsh as my shell.

adamraine commented 3 years ago

Turns out the args needed to be in an array:

"jestrunner.debugOptions": {
    "runtimeArgs": ["--experimental-vm-modules"]
},

Not sure where I got the idea to use a single string lol.

eltoroit commented 2 years ago

Hi,

Can you please share your settings (package.json, settings.json, jest-config.json, etc). I am trying to set this up using *.mjs files and I can't debug them with this extension.

I am getting this error: Cannot use import statement outside a module

Crono1981 commented 2 years ago

Like @eltoroit , I could really use a settings.json sample file.

Right now, it's as if jestrunner.* settings were ignored altogether. I even tried giving jestrunner.jestPath an unexisting path just to make sure it fails; it didn't.