vscode-jest-runner icon indicating copy to clipboard operation
vscode-jest-runner copied to clipboard

Debugging ESM works but not Running

Open jogibear9988 opened this issue 1 year ago • 1 comments

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

jogibear9988 avatar May 24 '24 05:05 jogibear9988

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!

AlessioGr avatar Jun 06 '24 14:06 AlessioGr