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

Debugging ESM works but not Running #365

Open jogibear9988 opened 3 months ago

jogibear9988 commented 3 months ago

I'm able to configure the jest runner to add --experimental-vm-modules for the debug comand, but not for run.

My config looks like this:

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

when I use "debug" the commandline lloks like this:

  /usr/bin/env 'NODE_OPTIONS= --require "/Applications/Visual Studio Code - Insiders.app/C
  ontents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.js"  --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS=:::{"inspectorIpc
  ":"/var/folders/dm/7fjzn8gd7v17k4018lb4pnwc0000gn/T/node-cdp.1136-5084c36a-25.sock","deferredMode":false,"waitForDebugger":"","execPath":"/usr/
  local/bin/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/var/folders/dm/7fjzn8gd7v17k4018lb4pnwc0000gn/T/node-debug-ca
  llback-87f4a491c48e5421"}' /usr/local/bin/node --experimental-vm-modules node_modules/.bin/jest /Users/jochenkuehner/Desktop/repos/github/nodep
  rojects/web-component-designer/packages/web-component-designer/tests/SpecificityCalculator.test.ts -c /Users/jochenkuehner/Desktop/repos/github
  /nodeprojects/web-component-designer/packages/web-component-designer/jest.config.js -t test\ 1 --runInBand 

but when I use the "run" it does not work.

I then tried to add:

    "jestrunner.runOptions": [
        "--experimental-vm-modules"
    ]

but this will not add the --experimental-vm-modules to node, but as a parameter for jest

AlessioGr commented 2 months ago

This is how we got it to work for both running and debugging

"jestrunner.jestCommand": "pnpm exec cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-deprecation\" node 'node_modules/jest/bin/jest.js'",
"jestrunner.debugOptions": {
  "runtimeArgs": ["--experimental-vm-modules", "--no-deprecation"]
}

Hope that helps!