Test TypeScript Errors Not Highlighted in IDE

I'm running my mocha tests with:

I get these errors in the terminal:

but why do I still see the IDE saying TS is all fine?:

the test runner is indeed reading my src/test/.tsconfig.json folder so I believe when I run mocha but the IDE doesn't seem to be in sync with those errors.

Here's my typescript IDE settings:

11 comments
Comment actions Permalink

Must be a configuration issue

How many tsconfig.*.json files do you have in your project? Could you share a project the issue can be repeated with?

0
Comment actions Permalink

The project is private but here's what I have

./tsconfig.json

./src/test/tsconfig.json

/src/server/tsconfig.json

How does the JetBrains test runner look for tsconfigs?  does it look through your entire project for all of them?  for only the root?  how does this work?

0
Comment actions Permalink

Here's another thing that's weird, kinda related.  So I tried to disable a TS error...and it didn't seem to pick up the turning off of that new rule I added.  Again I'm running this code from my tests:

Ran my tests again from the WebStorm test runner for mocha, and TS is still complaining both in the IDE like above and in the terminal:

Even when I outright supress it with a comment, it doesn't matter:

also tried adding this to my eslintrc, no luck:

"@typescript-eslint/no-unused-vars": "off"
0
Comment actions Permalink

>How does the JetBrains test runner look for tsconfigs?  

not sure I follow you... it's not the IDE that runs your tests. If your query refers to the Typescript language service, it follows the tsc logic, namely the nearest tsconfig.*.json the file is included in is used for linting

0
Comment actions Permalink

I have another warning but the same problem.
It says: "TS6133: 'offerOptions' is declared but its value is never read." when I hover but file has green checkmark and the parameter in question is not highlighted at all

0
Comment actions Permalink

Does the problem only occur with errors like TS6133? This is not the error, this is a suggestion- suggestions (as opposed to errors) coming from the compiler service are not highlighted in editor, only hints are available on hover

0
Comment actions Permalink

Type errors like TS2532: Object is possibly 'undefined' or TS2339: Property 'x' does not exist on type 'FooBar' are underlined.
And at an import or variable level it also underlines the error TS6133 eg for unused import Test from '../../model/Test'

But if you have a function or method which has an unused parameter it is not highlighted.


0
Comment actions Permalink

I see. This is expected, as I wrote above

0
Comment actions Permalink

If I understand you right unused imports and unused variables are TS6133 errors and unuses arguments with TS6133 are suggestions? And it is not expected to make these suggestions possible to highlight, correct?

0
Comment actions Permalink

Hello

I stumbled upon this as I was wondering why an unused property on Typescript (TS6138) is not highlighted. The handling of IntelliJ as described by Elena is pretty inconsistent: in Java an unused field is highlighted as Warning but in Typescript an unused property not, and conceptually both "messages" are the same.

Unused field in Java:

Unused property in Typescript

Also IntelliJ itself lists an "Unused symbol" within "Errors and Warnings" in the settings -> Color Scheme -> General.

So please reconsider the way IntelliJ treats "suggestions" to have a consistent experience with your IDE.

 

0

Please sign in to leave a comment.