Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Unit Tests Property 'toBeTruthy' does not exist on type 'Assertion'

Currently in a project Ive been assigned to there is an issue with VSCode not being able to determine the properties for the Jasmine assertions. The tests run successfully, but intellisense in VSCode cannot determine the package. This project has cypress configured along side jasmine, but I dont see any conflicts in the tsconfig.spec.json. enter image description here

enter image description here

like image 616
Austin Born Avatar asked Feb 03 '26 05:02

Austin Born


2 Answers

I was able to follow @aghwotu recommendation and added the below to my tsconfig.json in my root. This created other issues, but fixed my issue with VSCode not finding the jasmine Assertions.

"exclude": ["cypress.config.ts"],
"files": ["cypress.config.ts"]
like image 194
Austin Born Avatar answered Feb 04 '26 17:02

Austin Born


I encountered the same problem today. I know the problem is already a year old, but perhaps the answer will help someone else who also runs into this.

I added the following to my tsconfig.json:

  "exclude": [
    "cypress/**/*.ts",
    "cypress.config.ts"
  ]

And I changed my cypress/tsconfig.json, which extends the tsconfig.json, to:

  "include": [
    "**/*.ts",
    "../cypress.config.ts"
  ],
  "exclude": []

This solved my issues with types and functions not being recognized in my .spec files and also kept my Cypress e2e tests running.

I hope this still helps you or someone else.

like image 34
Rdev Avatar answered Feb 04 '26 18:02

Rdev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!