vscode-jest-runner icon indicating copy to clipboard operation
vscode-jest-runner copied to clipboard

Support running tests defined with `describe(ClassName.name`

Open golergka opened this issue 3 years ago • 5 comments

There's a popular pattern to write Jest tests with describe(ClassName.name) instead of describe("ClassName"), as this allows to (1) automatically update test names when entity (class or function) is renamed and (2) easily find all usages through the codebase. Unfortunately, jest runner doesn't yet support that.

golergka avatar Dec 05 '22 10:12 golergka

Implicitly asked for is for the extension to (possibly build), resolve, and evaluate code so it could deduce the test name, such that the plugin could give a solid match to jest cli regex pattern. It’s certainly feasible, but introduces (possibly) a lot of complexity, given the build ecosystem of js.

id personally opt to not support it, or, hear a comprehensive/robust proposal from the community that addresses these challenges, especially a solution that works without invoking jest first to resolve test names.

cdaringe avatar Dec 06 '22 01:12 cdaringe

Jest-Runner is based on vscode-jest-editor-support. (Same as vscode-jest). Which is based on the Babel Compiler.

Means it first need to be supported by vscode-jest-editor-support.

I think somewhere between my issues there was someone who tried to add support but failed.

firsttris avatar Dec 06 '22 04:12 firsttris

Would parsing with a regex be too complex?

hamncheez avatar Dec 07 '22 21:12 hamncheez

Would parsing with a regex be too complex?

explain more!

what's discussed above is a test name discovered by runtime evaluation of the test runner or node.js

cdaringe avatar Dec 08 '22 01:12 cdaringe

@firsttris do you know of an open issue with vscode-jest-editor-support to track the (possible) support of this feature?

simondel avatar Jun 19 '23 14:06 simondel