Allow tests to pass without any test files (e.g. via Vitest `passWithNoTests`)

オープン 初心者向け
#33,055 コメント 1 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
静か
技術スタック
angular, typescript
領域
cli, testing

調査の方向性

テストファイルがない場合のカスタムチェックについて説明されている、packages/angular/build/src/builders/unit-test/runners/vitest/build-options.ts の 161-170 行付近から始めます。テストコマンドが runner options を Vitest に渡す方法を確認し、続いて、デフォルトの動作を変更せずに、テストファイルのないプロジェクトが Vitest の passWithNoTests オプションによって成功することを検証します。

索引モデルが issue の本文から書いたものです。

説明

area: @angular/cli gemini-triaged
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:

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/angular-cli のほかの issue

angular/angular-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。