You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a test uses a dynamically created description (like describe("sum" + " some context", ...) then the testing panel in VSCode shows the text <unknown> instead of the real text:
But this only happens with enabled browser mode. When browser mode is disabled (running in node) then the description is shown directly.
When executing the tests then the <unknown> description is replaced with the correct one. But every time the tests are refreshed, the description vanishes again.
When using the browser mode, the extension parses the file instead of running it directly during the collection phase. This is needed because spinning up a browser just to collect tests is very expensive, and it's possible to make fast edits and halt your IDE even. You can achieve the same for your Node.js tests by enabling vitest.experimentalStaticAstCollect.
Ideally, it should at least show "sum" + " some context" as the name here instead of <unknown>.
Ideally, it should at least show "sum" + " some context" as the name here instead of <unknown>.
Wouldn't be that much more useful. It is such a simple expression because this is just a minimal example for this bug report. What I actually want to do there is calling a function which checks if test is executed in browser or node. And I only do this as a workaround for the other bug I just reported (#516) so Browser and Node tests have different paths so they are handled separately in vscode-vitest.
But maybe there are other use-cases for having a dynamic test description.
Now that #516 is fixed (Thanks! Works perfectly now!) I no longer need my workaround with dynamic test names. So feel free to close this issue. If I understood it correctly it cannot be improved further anyway.
EDIT: Sorry for the comment mess. I lost myself between pull requests and issues :D
Describe the bug
If a test uses a dynamically created description (like
describe("sum" + " some context", ...
) then the testing panel in VSCode shows the text<unknown>
instead of the real text:But this only happens with enabled browser mode. When browser mode is disabled (running in node) then the description is shown directly.
When executing the tests then the
<unknown>
description is replaced with the correct one. But every time the tests are refreshed, the description vanishes again.Reproduction
npm i
Refresh tests
button and expand the tree. It shows text<unknown>
Run tests
button. Now the description is correct.Refresh tests
again and the description is broken again.Output
Version
1.6.2
Validations
The text was updated successfully, but these errors were encountered: