-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vscode jest debug profile with external jest-config #43522
Comments
@firsttris what do you mean by "external config"? A "launch.json" will only be found if you open a project folder in VS Code (otherwise there is no ".vscode" folder where the launch.json could live). BTW, a somewhat simpler and clearer config for jest is: {
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
"args": [
"-i",
"-t", "should dispatch GetAccessToken Test",
"-c", "${workspaceFolder}/jest-config.json"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
} |
Hey @weinand thx for taking the time to reply to my issue! with external config i mean external Jest config jest-config.json if the jest-config is located in package.json i have no issue. |
i updated my debug-profile to the more cleaner version, thx! no issues running Jest with external jest-config from CLI. no issues with running VSCode Debug Profile for Jest and Jest-config in Package.json but Error with VSCode Debug Profile for Jest and Jest-Config in a external file e.g. ./jest-config.json |
Does it make a difference if you make the "jest-config.json" relative, e.g. {
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
"args": [
"-i",
"-t should dispatch GetAccessToken Test",
"-c jest-config.json",
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
} |
Same Issue
|
@firsttris the error message you are seeing originates from jest, not from VS Code. So you might want to investigate on the jest side as well, e.g. jestjs/jest#3499. |
i thought so as well.. but...
continue investigating on both sides |
So where does the jest-config.json actually live? |
jest-config.json is in the ProjectRoot Directory. i found out if i rename the jest-config.json to it finds the config without --config (-c) argument because they setup some default names, to look for:
for me this workaround is acceptable. if you don't want to explore further why --config (-c) is not working, we can close this issue |
Oh, I think I know what the problem is. Try this: {
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
"args": [
"-i",
"-t", "should dispatch GetAccessToken Test",
"-c", "jest-config.json"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
} I will fix my suggestion from above too (so that no one will find a bogus example). |
thanks for your help, your suggestion is working! now i can update my vscode addon 👍 |
Great, and sorry for not spotting this earlier. |
Holla,
I'm trying to create a jest debug profile with external config.
but i always get the following message:
Error: Can't find a root directory while resolving a config file path.
while running jest with config from cli is possible, im not able todo this from a vscode debug profile.
on cli you can pass config with -c jest-config.json
any advice?
regards
tristan
The text was updated successfully, but these errors were encountered: