simond
simond

Reputation: 764

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

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

Upvotes: 18

Views: 8629

Answers (2)

djjeck
djjeck

Reputation: 1840

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.

Upvotes: 4

Willem
Willem

Reputation: 927

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
}

Upvotes: 10

Related Questions