Open Elias-Graf opened 3 years ago
I have no understanding of your code base, but buildJestArgs
withQuotes
seems to be hard coded to false
here:
I would honestly recommend just always quoting the string.
I have a slightly related bug: if I have double quotes in the description string, it makes the run of the test to fail.
Test:
describe('ApiErrorHandlerService error handling', () => {
describe('Test base behavior', () => {
it('should "handle API error" for 403 / detailled error', (done) => {
Click on the Run button above the it:
> node "c:/_Projets/front/ng-oo-core/node_modules/jest/bin/jest.js" "c:/_Projets/front/ng-oo-core/utils/http/src/lib/api-error-handler.service.spec.ts" -t "ApiErrorHandlerService error handling Test base behavior should "handle API error" for 403 / detailled error"
Test Suites: 2 skipped, 0 of 2 total
Tests: 5 skipped, 5 total
Snapshots: 0 total
Time: 7.593 s
Ran all test suites matching /c:\\_Projets\\front\\ng-oo-core\\utils\\http\\src\\lib\\api-error-handler.service.spec.ts|API|error for 403 \\ detailled error/i with tests matching "ApiErrorHandlerService error handling Test base behavior should handle".
One way to avoid this is to backslash double quotes in the descriptions when building the command line.
Unless they are escaped? Like in it("should \"handle API error\" for 403 / detailled error", (done) => {
?
I will let you test this case.
@PhiLhoSoft I don't think that your issue is related to mine as they occur when pressing the "Run" button. Mine only do when I "Debug". Your issue sounds more like an escaping issue (??).
Also, your tests seem to run, no? I don't see any failed test in the output you posted.
They skip all the tests instead of running the one I wanted… :-) Ie. it finds no matches. It is, somehow, related as both issues look like missing escaping in the command line, unless I am mistaken. Otherwise, I can open my own issue.
They skip all the tests instead of running the one I wanted… :-) Ie. it finds no matches. It is, somehow, related as both issues look like missing escaping in the command line, unless I am mistaken. Otherwise, I can open my own issue.
I can confirm I'm having the same issue with using double quotes in the describe argument. When I try to run the test it runs fine but it is skipped when trying to debug.
It can be quotes also. For example, this test:
describe("This is always 'true'", () => {
it("1 is less than 2", () => {
expect(1).toBeLessThanOrEqual(2);
});
});
when invoking the "Run" codelens everything is fine.
The cpmmand line argument is:
-t 'This is always '\''true'\'' 1 is less than 2'
When clicking the debug codelens, the test is skipped.
The commmand line argument is:
-t This\ is\ always\ \'\\\'\'true\'\\\'\'\ 1\ is\ less\ than\ 2
There is probably too much escaping in there :-)
They skip all the tests instead of running the one I wanted… :-) Ie. it finds no matches. It is, somehow, related as both issues look like missing escaping in the command line, unless I am mistaken. Otherwise, I can open my own issue.
I can confirm I'm having the same issue with using double quotes in the describe argument. When I try to run the test it runs fine but it is skipped when trying to debug.
I have the same issue. I had to replace double quotes with single quotes to be able to debug
The debug option does not surround the pattern with (single) quotes. This is an issue because I'm using NextJs, and NextJs uses brackets (
[]
) in the file path, which are used in regex. This leads tono matches found
.How to reproduce
Execute the following commands:
Fill the files with content:
Then press the debug option in the test.
The output of run is:
Which has quotations enclosing the file pattern.
And the output of debug is:
Which does not have quotations enclosing the file pattern.
Possible related issue
While writing this issue I found https://github.com/firsttris/vscode-jest-runner/issues/30 which is possible related.