Jasmine test explorer not showing test cases(it blocks) list in jasmine test explorer in visual studio code
Asked Answered
P

2

18

I am using Visual Studio code, Protractor, Typescript and Jasmine framework. I have spec test cases within "it" block.

To see all the test cases or it blocks I have installed "Jasmine Test Explorer " and "Jasmine Explorer UI" but somehow test cases are not listed.

Could you please help me to resolve this.

enter image description here

Putdown answered 26/6, 2018 at 11:16 Comment(3)
Did you get it to work? I have the exact same problem.Dees
I am facing the same problem. Did you solve this?Wakerly
same issue. no tests are shown for me. Webstorm has it implemented by default. Would be nice to make it work on VSC.Mada
S
10

Here is a possible solution:

Create a setting pointing to your config file (e.g. in .vscode/settings.json):

{
  "jasmineExplorer.config": "jasmine.json",
  ...
}

In the jasmine.json file, you tell the explorer where the specifications are. Here is an example:

{
    "spec_dir": "site/dist/tests",
    "spec_files": ["**/*[sS]pec.js"],
    "helpers": ["helpers/**/*.js"],
    "random": false,
    "seed": null,
    "stopSpecOnExpectationFailure": false
}
Syphilis answered 8/8, 2018 at 6:38 Comment(5)
Where this jasmine.config locates?Wakerly
@ChamilaMaddumage I improved the answer. I incorrectly said jasmine.config where I meant jasmine.json. Thanks for asking.Syphilis
To add to this: The default location is normally spec/support/jasmine.json so you can just create the file there. I got it by clicking on the settings icon for Jasmine Test Explorer. Also, it's best to set your tests to random (a change from the listed file).Asante
I had moved the jasmine.json to a different location...addition to .vscode/settings.json did the trick!Rodriquez
This answer is for JS files, the question asks about TS tests. Even by updating the file paths, it doesn't work for me. I can see JavaScript tests, but as soon as I add a TypeScript one, all tests disappearParegoric
P
4

The Test Explorer plugin will not show any test if an error is encountered. To check if there were any errors during the compilation of your tests, go to the Jasmine Explorer Log in the Output tabs of VSCode (View -> Output) enter image description here

You can see that in my case I was having an issue with module resolution that I fixed by tweaking tsconfig.json.

Paregoric answered 12/5, 2020 at 4:30 Comment(2)
I cant even see this log item.Ore
@CodeNameJack find (near the bottom) "jasmineExplorer.logpanel: Write diagnotic logs to an output panel called "Jasmine Explorer Log"" in marketplace.visualstudio.com/…Beaconsfield

© 2022 - 2024 — McMap. All rights reserved.