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

Test skipped if "describe" or "it" is not a string

Open andreviallon opened this issue 2 years ago • 4 comments

Hello,

I have an issue when running tests in a file where either the name of a "describe" or a "it" is not a string but instead a function.name. In the example bellow I use sum.name as the name for the describe (line 3 in sum.spec.ts) and all tests will be skipped when running tests through the extension.

Does not work: Screenshot 2022-03-04 at 13 50 43

Works: Screenshot 2022-03-04 at 13 51 15

andreviallon avatar Mar 04 '22 12:03 andreviallon

We're having the same issue, if this could be fixed it would be awesome, as using the function names provides a much easier and more consistent way of naming test suites for a given method, and makes renaming the test seamless when the method name changes, as it's just using the reference to the method name.

AbrahamLopez10 avatar Jun 15 '22 16:06 AbrahamLopez10

Does the jest-cli support escaping currently? If not, this bug might be needed to be fixed in the jest-cli, not vscode :/

mhombach avatar Jun 26 '22 14:06 mhombach

Does the jest-cli support escaping currently? If not, this bug might be needed to be fixed in the jest-cli, not vscode :/

Well, the extension works when running tests for the whole file in watch mode, so I guess it's bug

andreviallon avatar Jun 30 '22 06:06 andreviallon

Does the jest-cli support escaping currently? If not, this bug might be needed to be fixed in the jest-cli, not vscode :/

Well, the extension works when running tests for the whole file in watch mode, so I guess it's bug

Testing the full file is not a problem. The problem is, that, when testing specific tests from a test-file, the name of the test-case is passed as parameter to the jest-cli. If this name however contains certain quotation-chars, this is basically ending the parameter too early. I'm not sure if the jest-cli currently supports escaped quotes in its cli-params? I've had this problem with different vscode-extensions, they all had trouble with certain quotes :/

mhombach avatar Jun 30 '22 10:06 mhombach