Closed rochejul closed 3 months ago
@rochejul
[updated] A template string is considered dynamic because its content might not match the "resolved" string that Jest compares against. Therefore, you need to first "resolve" the dynamic names by running the parent block (a non-dynamic named describe block that encloses it, or the test file itself) at least once. After that, you can run or debug the test directly by its resolved name.
We can assist you further if you can provide more details about your specific issue.
Hi @connectdotz
I found the generated commands
This works fine:
/usr/bin/env 'NODE_OPTIONS= --require /snap/code/163/usr/share/code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js --experimental-vm-modules --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS=:::{"inspectorIpc":"/tmp/node-cdp.3597-9a5327ae-43.sock","deferredMode":false,"waitForDebugger":"","execPath":"/home/julien-roche/.volta/bin/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/tmp/node-debug-callback-c97c24f06ada6010"}' /home/julien-roche/.volta/bin/node node_modules/.bin/jest --runInBand --no-cache --coverage=false --colors --verbose --watchAll=false /home/julien-roche/dev/github/web-component-attribute-polyfill/packages/core/test/engine.test.js -c /home/julien-roche/dev/github/web-component-attribute-polyfill/packages/core/jest.config.json -t Core\ -\ engine\ observeCustomAttribute --no-cache --coverage=false --runInBand
This fails (when we use the `):
/usr/bin/env 'NODE_OPTIONS= --require /snap/code/163/usr/share/code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js --experimental-vm-modules --inspect-publish-uid=http' 'VSCODE_INSPECTOR_OPTIONS=:::{"inspectorIpc":"/tmp/node-cdp.3597-98324501-46.sock","deferredMode":false,"waitForDebugger":"","execPath":"/home/julien-roche/.volta/bin/node","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"/tmp/node-debug-callback-5efc8ec4de10473c"}' /home/julien-roche/.volta/bin/node node_modules/.bin/jest --runInBand --no-cache --coverage=false --colors --verbose --watchAll=false /home/julien-roche/dev/github/web-component-attribute-polyfill/packages/core/test/engine.test.js -c /home/julien-roche/dev/github/web-component-attribute-polyfill/packages/core/jest.config.json -t Core\ -\ engine\ observeCustomAttribute\ it\ calls\ the\ attribute\ changed\ callback\ when\ the\ attribute\'\\\'\'s\ value\ has\ changed --no-cache --coverage=false --runInBand
The title of the test:
test(`it calls the attribute changed callback when the attribute's value has changed`, async () => {
I wonder if there is not an issue on escaping in this case
Regards
@rochejul, I tested the exact test name in a vanilla project, and it ran/debugged fine.
However, I need to correct my previous comment that some template-string-named tests can be run at any time. It turns out that all template string test names are considered dynamic, so they need to be resolved prior to debugging/running directly.
I am guessing this issue might be related to your specific project settings. Do you have a sample repo we can dig further?
Hi @connectdotz
I have a repository where I work on
I created this branch for you: https://github.com/rochejul/web-component-attribute-polyfill/tree/invest/1160-vscode-debugger-and-back-quote
You could modify the following test: https://github.com/rochejul/web-component-attribute-polyfill/blob/invest/1160-vscode-debugger-and-back-quote/packages/core/test/engine/observe.test.js#L235 and set the title:
test(`it calls the attribute changed callback when the attribute's value has changed`, async () => {
I hope it could help
Let me know if you find some clues and I could help you
Regards
@rochejul, I tested your sample repo on macOS, and everything works as expected.
I did need to make a few changes in your repo to get it running. One is creating a custom debug config with NODE_ENV
. You probably have done that too; otherwise, it wouldn't run at all.
This is the command line regarding --testNamePattern
correctly generated by the VSCode debugger:
--testNamePattern core\ -\ engine\ -\ observe\ observeCustomAttribute\ it\ calls\ the\ attribute\ changed\ callback\ when\ the\ attribute\'s\ value\ has\ changed\$
I assume you can "run" this individual test, which means the extension has correctly spawned the shell and escaped the test name for the Jest run.
During debugging, it is the VSCode debugger that is responsible for spawning the shell and preparing the arguments. It worked correctly on my machine (macOS 14.6). This leads me to consider two possibilities:
Hi
Weird, I configured volta to use nodejs 20: https://github.com/rochejul/web-component-attribute-polyfill/blob/3bb3be6abbffc1a2563d9a2441fdc264e5b61671/package.json#L90
How do you see the nodejs version?
I will check for the vscode version and for the plugin version
Le dim. 4 août 2024, 23:38, ConnectDotz @.***> a écrit :
@rochejul https://github.com/rochejul, I tested your sample repo on macOS, and everything works as expected.
I did need to make a few changes in your repo to get it running. One is creating a custom debug config with NODE_ENV. You probably have done that too; otherwise, it wouldn't run at all.
This is the command line regarding --testNamePattern correctly generated by the VSCode debugger:
--testNamePattern core\ -\ engine\ -\ observe\ observeCustomAttribute\ it\ calls\ the\ attribute\ changed\ callback\ when\ the\ attribute\'s\ value\ has\ changed\$
I assume you can "run" this individual test, which means the extension has correctly spawned the shell and escaped the test name for the Jest run.
During debugging, it is the VSCode debugger that is responsible for spawning the shell and preparing the arguments. It worked correctly on my machine (macOS 14.6). This leads me to consider two possibilities:
- I noticed you are using Node version 10.7. This is quite old. Both Jest and the extension have stopped officially supporting Node < 18.x. Try upgrading your Node and test again if you can.
- It could also be a VSCode issue. Which version of VSCode are you running? If you are already running the latest version, then try running it on a different platform to see if the issue is platform-specific.
— Reply to this email directly, view it on GitHub https://github.com/jest-community/vscode-jest/issues/1160#issuecomment-2267715589, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB32B5DGGJOXECSXN2CZ73ZP2NO7AVCNFSM6AAAAABKXLSLMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRXG4YTKNJYHE . You are receiving this because you were mentioned.Message ID: @.***>
From my laptop I have the following configuration:
@connectdotz I will be away from keyboard for the next days
Please let me know if you have further details
If needed, please close the issue and I will have a deeper and if needed I will provide a PR
Thanks a lot
Ok, It looks like your original issue post might have listed the wrong node version.
I also noticed another difference: you have both the vscode-jest
and vscode-jest-runner
extensions installed. Since they offer similar functionality, there could be some interference between them. You can try temporarily disabling the vscode-jest-runner
extension to see if that makes any difference.
Hi @connectdotz I still have the issue
I will close the ticket and I will try to debug it furthermore
Many thanks for your help
Regards
Describe the bug No break point could hit when we run a specify test using as naming the es6 template string however the describe debug action will be able to enable the breakpoint
To Reproduce Steps to reproduce the behavior:
Note: A sample repo will help us identify the bug much faster. 🙏
Expected behavior We should be able to execute breakpoints regardless if we name the test with single quote, double quote, string template
Environment (please complete the following information):
node -v
: 10.7.0npm -v
:Prerequisite
The fastest (and the most fun) way to resolve the issue is to submit a pull request yourself. If you are interested, please check out the contribution guide, we look forward to seeing your PR...