{"id":17473665,"url":"https://github.com/davidlj95/angular-18-cypress-jasmine-types","last_synced_at":"2025-03-28T10:44:13.546Z","repository":{"id":258341221,"uuid":"861388168","full_name":"davidlj95/angular-18-cypress-jasmine-types","owner":"davidlj95","description":"Minimal reproduction for JetBrains IDEs issue about unit test types and Cypress","archived":false,"fork":false,"pushed_at":"2024-10-18T10:37:59.000Z","size":300,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-18T14:37:35.655Z","etag":null,"topics":["cypress","jasmine","jetbrains-ides","minimal-reproduction","unit-testing","webstorm"],"latest_commit_sha":null,"homepage":"https://youtrack.jetbrains.com/issue/WEB-68686","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidlj95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-22T18:55:35.000Z","updated_at":"2024-10-16T14:06:04.000Z","dependencies_parsed_at":"2024-10-18T14:37:39.458Z","dependency_job_id":null,"html_url":"https://github.com/davidlj95/angular-18-cypress-jasmine-types","commit_stats":null,"previous_names":["davidlj95/angular-18-cypress-jasmine-types"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-18-cypress-jasmine-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-18-cypress-jasmine-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-18-cypress-jasmine-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidlj95%2Fangular-18-cypress-jasmine-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidlj95","download_url":"https://codeload.github.com/davidlj95/angular-18-cypress-jasmine-types/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246014754,"owners_count":20709871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cypress","jasmine","jetbrains-ides","minimal-reproduction","unit-testing","webstorm"],"created_at":"2024-10-18T18:06:10.592Z","updated_at":"2025-03-28T10:44:13.516Z","avatar_url":"https://github.com/davidlj95.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular18CypressJasmineTypes\n\nThis is a minimal reproduction for [an issue](https://youtrack.jetbrains.com/issue/WEB-68686) in JetBrains IDEs. TL;DR: IDE thinks unit tests are Chai/Mocha tests but they're Jasmine ones. Probably because confusing them with Cypress tests instead. Therefore unit test assertions (i.e.: `toBeTruthy`) appear in red color as the definitions aren't found. Though they actually work (like when running them with `ng test`)\n\n## UPDATE: Refer to `app/spec` Typescript configs\n\nAfter [reply from a JetBrains team member](https://youtrack.jetbrains.com/issue/WEB-68998/Paths-from-tsconfig.app.json-are-ignored#focus=Comments-27-10762562.0-0), the suggested fix is to refer to `tsconfig.app/spec.json` from `tsconfig.json` \n\nThis has been applied in [commit `24f929b`](https://github.com/davidlj95/angular-18-cypress-jasmine-types/commit/24f929b1da27a88d2c623c2c99c55e0c8961d555)\n\nAfter that, when using WebStorm 2024.2.3 seems the issue about assertion types is fixed.\n\nThough the docs / \"Go to declaration\" of `beforeEach`, `describe`, `it` and `expect` are wrong.\nWhen using \u003ckey\u003eCmd\u003c/key\u003e + \u003ckey\u003eB\u003c/key\u003e and \u003ckey\u003eF1\u003c/key\u003e to see docs, Mocha/Chai docs appear:\n\n![](screenshot-mochasmine.png)\n\nMocha ones appear for `beforeEach`, `describe` and `it`. Chai ones for `expect`.\n\nWhen using \"Go to declaration or usages\" you go to `(chai|mocha)/index.d.ts`\n\n## Creating the repository\nTo create the repository, a fresh Angular app has been created with the following command:\n\n```shell\npnpm dlx @angular/cli new \\\n  --package-manager=pnpm \\\n  angular-18-cypress-jasmine-types\n```\n\nChoosing defaults: CSS + no SSR/SSG. Using `pnpm` for `p`erformance purposes.\n\n## Reproducing the issue\n\nThe issue isn't be there when cloning the repo. However, switch into one of the two branches:\n\n- [`root-schematic`](https://github.com/davidlj95/angular-18-cypress-jasmine-types/tree/root-schematic). Where Cypress has been added via [Cypress Angular Schematic](https://www.npmjs.com/package/@cypress/schematic)\n- [`root-manual`](https://github.com/davidlj95/angular-18-cypress-jasmine-types/tree/root-manual). Where Cypress has been added manually by `pnpm install -DE cypress`\n\nFor instance, `git checkout root-manual`. Then run `pnpm install`. Open the example unit test file `app.component.spec.ts`. The issue appears. `toBeTruthy` appears in red color. Amongst the rest of assertions too.\n\n### Extra notes\nWhen switching back to `main` branch to write this note in `README.md` the issue disappeared. Switching to a branch where Cypress has been added, raises the issue back again. \n\nNotice some time must pass for the red color to appear. What is instant is that hovering over `toBeTruthy` or other assertions triggers a popup saying that there are no definitions available. When if in `main` branch where no Cypress exists, hovering over the assertion triggers a popup with Jasmine's documentation\n\nTurned off `Test Automation` plugin just in case. Restored default settings just incase. Invalidated caches too.\n\n\u003e Now `Test Automation` plugin is reporting an issue about OpenAPI when enabling it back. Will create a separate issue for that too.\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 18.2.5.\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidlj95%2Fangular-18-cypress-jasmine-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidlj95%2Fangular-18-cypress-jasmine-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidlj95%2Fangular-18-cypress-jasmine-types/lists"}