JamieMason / karma-jasmine-matchers

A Karma plugin to inject Jasmine-Matchers for Jasmine and Jest.
https://www.npmjs.com/package/karma-jasmine-matchers
46 stars 7 forks source link

Webstorm and VisualCode complaining about the new Matchers #22

Open gpeel opened 2 years ago

gpeel commented 2 years ago

Starting with a fresh new Angular 14 project and following instruction to install karma-jasmine-matchers enable correct execution of tests but the 2 IDEs complains about the added matchers.

image image

the code is availlable at URL

JamieMason commented 2 years ago

Hi @gpeel, my answer is a little broad and vague just because I don't have much information to work with so far. How does your setup compare to the instructions here? If it matches, what versions are you using?

gpeel commented 2 years ago

Hi well I followed exactly those instructions And also in the last line of the the preceding post, I give access to a full code in github to check what I did. Here it is: https://github.com/gpeel/test-adding-jasmine-matchers

So my conclusion so far is that there seems to be something missing from those insctructions. since starting afresh with a new project does not work. I tries to change a few things but never was able to make it work

gpeel commented 2 years ago

I found a way to solve the problem by adding those lines in tsconfig.json

    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/jasmine-expect/dist"
    ]

Or another solution, to add /// <reference types="jasmine" /> at the top of the test file. Then the IDE find the definitions

But looking at the file ./node_modules/jasmine-expect/package.json the types property is already set to dist/index.d.ts So it should work automatically, but it doesn't.

Any idea why ?