Closed marviobezerra closed 10 months ago
Hi, just want to make sure you are aware the debug config can be customized if the default one (best effort, generated from jest.jestCommandLine
) does work for you. Please see how to debug; you might need to customize the debug config given your command line is a bit more complex.
I'm aware that it's possible to customize the debug. However, I think that it's odd that the extension does not handle the node path properly. The ./ is being added in the wrong place. More over, my test command is not complex. It's just a "jest test"
It's true that the auto-generated debug config is kind of naive. It recognizes only limited patterns in jest.jestCommandline
, such as npm
or yarn
, and treats the rest as a "command" to which it appends a relative path. "/" prefix.
This is expected behavior. We figure instead of deploying complex logic to guess what each user's command line is trying to do, it would be better to just let developers custom their debug config.
close as it's expected behavior. Feel free to reopen it if you have other related issues.
Environment
vscode-jest version
: [5.2.3]node -v
: [20.9.0]npm -v
oryarn --version
: [10.1.0]npm ls jest
ornpm ls react-scripts
(if you haven’t ejected): [29.7.0]Prerequisite
Steps to Reproduce
Install Node Js using ASDF.
Add a method, for example
Add a test, for example:
Define the Jest Config
const config: JestConfigWithTsJest = { displayName: 'testerpals-server', preset: '../../jest.preset.js', coverageDirectory: '../../coverage/apps/feature', testEnvironment: 'node', transform: { '^.+\.[tj]s$': ['ts-jest', { useESM: true, tsconfig: '/tsconfig.spec.json'
}],
},
globalSetup: "./.scripts/jest.global.ts",
setupFilesAfterEnv: ['./.scripts/jest.after.ts'],
moduleFileExtensions: ['ts', 'js', 'html'],
extensionsToTreatAsEsm: [".ts"],
moduleNameMapper: {
"^(\.{1,2}/.*)\.js$": "$1",
}
};
export default config;
/usr/bin/env 'NODE_OPTIONS= --require "/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.js" --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS=:::{"inspectorIpc":"/var/folders/8f/__yz55dn123fw7_c87863h040000gq/T/node-cdp.43982-26f4e9af-13.sock","deferredMode":false,"waitForDebugger":"","execPath":"/Users/me/.asdf/shims/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/var/folders/8f/__yz55dn123fw7_c87863h040000gq/T/node-debug-callback-d090df5f3bea03a8"}' /Users/me/.asdf/shims/node ./NODE_OPTIONS=--experimental-vm-modules npx jest --runInBand --watchAll=false --testNamePattern feature\ check\ value --runTestsByPath /Users/me/git/apps/server/src/feature/service.service.spec.ts
... NODE_OPTIONS=--experimental-vm-modules npx jest --runInBand ...