Allow tests to pass without any test files (e.g. via Vitest `passWithNoTests`)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 静か
- 技術スタック
- angular, typescript
調査の方向性
テストファイルがない場合のカスタムチェックについて説明されている、packages/angular/build/src/builders/unit-test/runners/vitest/build-options.ts の 161-170 行付近から始めます。テストコマンドが runner options を Vitest に渡す方法を確認し、続いて、デフォルトの動作を変更せずに、テストファイルのないプロジェクトが Vitest の passWithNoTests オプションによって成功することを検証します。
索引モデルが issue の本文から書いたものです。
説明
Command
test
Description
Executing the test command on a project (app or lib) that does not have any test files (yet) will always lead to the following error message:
An exception occurred while getting runner-specific build options:
Error: No tests found matching the following patterns:
- Included: **/*.spec.ts, **/*.test.ts
Please check the 'test' target configuration in your project's 'angular.json' file.
However, many use cases exist where this behaviour is unintended. For example, a freshly generated project (even more so in a monorepo) will often start out without any real test cases defined, and it even may take some time for the first ones to be written. Even at this early point, though, I (as a developer) will usually want to already integrate test execution into a quality gate setup (like continuous integration).
Currently, the Angular CLI does not offer a way to allow the test command to succeed when no test files exist.
Related issue: https://github.com/nrwl/nx/issues/34241
Describe the solution you'd like
The most pragmatic solution would probably be:
- Remove the custom Angular CLI check for test files, see: https://github.com/angular/angular-cli/blob/5adc92541433be23fc2246db5a199cf5c0dc9e67/packages/angular/build/src/builders/unit-test/runners/vitest/build-options.ts#L161-L170
- Instead, rely on Vitest and its
passWithNoTestsoption - which isfalseby default, so no breaking change is to be expected (besides a different log message)
Describe alternatives you've considered
Alternatively:
- The Angular CLI test command could also expose its own option. This would however collide with the respective Vitest option and thus require conflict resolution / priority checks. Plus, skimming the source code leads me to believe that the Angular CLI is currently not actively loading any custom Vite config, just passing it on - so changes here would presumably affect multiple places.
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 16時間 21分
- マージ済み PR(30日)
- 170
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/angular-cli のほかの issue
-
area: @angular/build gemini-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
angular/angular-cli#33955 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 担当者 1 名 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 担当者 1 名 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 担当者 1 名 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34124 · コメント 1 件 · 担当者 1 名 ·
angular/angular-cli の issue をすべて見る
似ている issue
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
Ecosystem: ClawMetry — the Qwen Code reader is now free and open source (follow-up to #9294 / #9338) オープンcategory/integration priority/P3 scope/documentation status/ready-for-human type/feature-request
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
area:auth FE mvp P3
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
klasolsson81/jobbliggaren#1788 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
get-convex/migrations#69 ·
-
accessibility angular bug good first issue typescript ux
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
apache/fineract-backoffice-ui#584 · コメント 1 件 ·