-
Notifications
You must be signed in to change notification settings - Fork 487
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
Find out and document how to debug unit tests from VSCode #2118
Comments
@yurishkuro would like to help |
@yurishkuro Does this work ? {
"type": "node",
"request": "launch",
"name": "Jest: current file",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${relativeFile}",
"--config",
"jest.config.js" // this would run the jest test for current file when we launch on vscode
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}"
} |
does it work for you? |
i got a dependency conflict on npm i ,
|
@yurishkuro should i resolve it directly , or is there any other solution for this ? |
I was also getting this |
@yurishkuro I did try various changes but it did not fix it , any suggestion where I should focus , I did see that jest is having a problem with esm modules , but in the docs i found the support for it is experimental, |
@yurishkuro does this look fine ? |
(a) you have test name hardcoded, instead of using the current test file, (b) can you set breakpoints? |
+1 please open a PR |
@yurishkuro was wondering where should i keep the launch.json ? |
Readme or launch.example.json |
## Which problem is this PR solving? Resolve #2118 ## Description of the changes - Added a launch json in the README.md which explains how to set the debugger of vscode to test unit tests with jest. ## How was this change tested? - Proof of work was present in the comment thread of the issue #2118 ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [] I have added unit tests for the new functionality - [] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `yarn lint` and `yarn test` --------- Signed-off-by: RISHIKESHk07 <rishikeshkuppala@gmail.com> Signed-off-by: Yuri Shkuro <github@ysh.us> Co-authored-by: Yuri Shkuro <github@ysh.us>
How to run and debug unit tests is rather confusing, we need to document it better.
For example, from the command line it's possible to run a test like this:
However, to run with debugger in VSCode we need a launch configuration, and I had trouble coming up with a generic one.
This one has file name hardcoded:
The text was updated successfully, but these errors were encountered: