firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
264 stars 124 forks source link

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

Open golergka opened 1 year ago

golergka commented 1 year ago

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.

cdaringe commented 1 year ago

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.

firsttris commented 1 year ago

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.

hamncheez commented 1 year ago

Would parsing with a regex be too complex?

cdaringe commented 1 year ago

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

simondel commented 1 year ago

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