Title: "No test suite found in file" error when running Vitest · Issue #32252 · angular/angular-cli · GitHub
Open Graph Title: "No test suite found in file" error when running Vitest · Issue #32252 · angular/angular-cli
X Title: "No test suite found in file" error when running Vitest · Issue #32252 · angular/angular-cli
Description: Which @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description I came across this error and the fix seemed to be to remove the export const statement from the spec, then export it from its...
Open Graph Description: Which @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description I came across this error and the fix seemed to be to remove the export const statemen...
X Description: Which @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description I came across this error and the fix seemed to be to remove the export const stat...
Opengraph URL: https://github.com/angular/angular-cli/issues/32252
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"\"No test suite found in file\" error when running Vitest","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nDon't known / other\n\n### Is this a regression?\n\nNo\n\n### Description\n\nI came across this error and the fix seemed to be to remove the `export const` statement from the spec, then export it from its own file.\n\nI first reported this to Vitest, but they pointed out that running the test using `npm run test` fails while simple running with the command `vitest` passes. The maintainers suggested that it was an Angular bug.\n\nI created a new StackBlitz from the Angular template, ensured that it was the latest version of Angular, installed vitest and jsdom, and added the minimum config to get it up and running.\n\n### Please provide a link to a minimal reproduction of the bug\n\nhttps://stackblitz.com/edit/stackblitz-starters-sj74ev3n?file=src%2Fabc.spec.ts\n\n### Please provide the exception or error you saw\n\n```true\n❯ npm run test\n\n\u003e test\n\u003e ng test --no-watch\n\n RUN v4.0.16 /home/projects/stackblitz-starters-sj74ev3n\n\n ✓ demo src/abc.spec.ts \u003e Main \u003e should run 2ms\n ✓ demo src/abc.spec.ts \u003e Main \u003e should run 0ms\n\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯\n\n FAIL demo src/main.spec.ts [ src/main.spec.ts ]\nError: No test suite found in file /home/projects/stackblitz-starters-sj74ev3n/src/main.spec.ts\n⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯\n\n\n Test Files 1 failed | 1 passed (2)\n Tests 2 passed (2)\n Start at 14:05:42\n Duration 3.52s (transform 91ms, setup 2.06s, import 51ms, tests 5ms, environment 620ms)\n```\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI : 21.0.2\nAngular : 21.0.3\nNode.js : 20.19.1\nPackage Manager : npm 10.8.2\nOperating System : linux x64\n\n┌───────────────────────────┬───────────────────┬───────────────────┐\n│ Package │ Installed Version │ Requested Version │\n├───────────────────────────┼───────────────────┼───────────────────┤\n│ @angular/animations │ 21.0.3 │ ^21.0.3 │\n│ @angular/build │ 21.0.2 │ ^21.0.2 │\n│ @angular/cli │ 21.0.2 │ ^21.0.2 │\n│ @angular/common │ 21.0.3 │ ^21.0.3 │\n│ @angular/compiler │ 21.0.3 │ ^21.0.3 │\n│ @angular/compiler-cli │ 21.0.3 │ ^21.0.3 │\n│ @angular/core │ 21.0.3 │ ^21.0.3 │\n│ @angular/forms │ 21.0.3 │ ^21.0.3 │\n│ @angular/platform-browser │ 21.0.3 │ ^21.0.3 │\n│ @angular/router │ 21.0.3 │ ^21.0.3 │\n│ rxjs │ 7.8.2 │ ^7.8.1 │\n│ typescript │ 5.9.3 │ ^5.9.3 │\n│ vitest │ 4.0.16 │ ^4.0.15 │\n│ zone.js │ 0.16.0 │ ^0.16.0 │\n└───────────────────────────┴───────────────────┴───────────────────┘\n```\n\n### Anything else?\n\nOriginal issue report to Vitest: https://github.com/vitest-dev/vitest/issues/9412#issuecomment-3725079819","author":{"url":"https://github.com/NateRobinsonAA","@type":"Person","name":"NateRobinsonAA"},"datePublished":"2026-01-08T20:29:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/32252/angular-cli/issues/32252"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:47671276-db67-d37c-f417-36570317e964 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA4E:29A342:3302CE4:43D2E82:6964A663 |
| html-safe-nonce | 07f959ac886149c1cfb1c2938cc680871774f5cf42984d1cc949668c085ebfa8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTRFOjI5QTM0MjozMzAyQ0U0OjQzRDJFODI6Njk2NEE2NjMiLCJ2aXNpdG9yX2lkIjoiNDQ1MTE5NzU0NDkwOTAyMjgxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ed49a7fbe766279f0bd43df0923a1540a657d3678cfada6a34b1e291d7bdb1bd |
| hovercard-subject-tag | issue:3794360536 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/32252/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0ea8ee8ef1061a2732020a6b7982d5096c0350cabd6f231760c1ce90e190330a/angular/angular-cli/issues/32252 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0ea8ee8ef1061a2732020a6b7982d5096c0350cabd6f231760c1ce90e190330a/angular/angular-cli/issues/32252 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? Don't known / other Is this a regression? No Description I came across this error and the fix seemed to be to remove the export const statemen... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NateRobinsonAA |
| hostname | github.com |
| expected-hostname | github.com |
| None | 15579c46431b7fd25941c3b09010f74fd1890c7a35226839bbbf40ce70fb3057 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 499abb347cb197601d399c346cfeb4b3fa135d5c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width