10

I have a tsconfig file like this

{
  "include": ["tests/**/*.ts"],
  "exclude": [],
  "compilerOptions": {
    "composite": true,
    "lib": [],
    "skipLibCheck": true,
    "outDir": "lib",
    "types": ["vitest/globals"]
  }
}

as I have defined types for vitest/globals so yarn vitest cmd is working fine and executing the tests cases as well. But in the VS Code its showing me error
enter image description here

How I can fix/silent it in vs-code?

coure2011
  • 40,286
  • 83
  • 216
  • 349

1 Answers1

11

I had to add the following to my .eslintrc.json file to fix this issue in a test setup module:

"globals": {
  "vi": true
},

However if you're using TypeScript, you should also add this to your compilerOptions in your tsconfig.json:

"types": ["vitest/globals"]

edit: you already had this in your tsconfig.json but I'll leave it in here anyway in case it helps someone

Jim Skerritt
  • 4,348
  • 2
  • 28
  • 25