angular / angular/angular-cli

Allow custom wsEndpoint for Playwright

オープン
#33,115 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: @angular-devkit/build-angular gemini-triaged
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### Command

build

### Description

In our project, I've been trying to set up visual regression testing using Vitest, and to make the screenshot tests stable, we want to make those tests in the same environment, regardless of the developers' OS, which can impact the tests. When using Playwright as a browser provider, Vites allows for providing/overriding the WS endpoint, which is not respected & overridden in the unit test builder.

After a quick look at the code, presumably this is being dropped in `browser-provider.ts:164-87` - `providerFactory(..)` function is called with only `baseOptions`, and also, `plugins.ts:265-284` has some more overrides, and comments (`// CLI provider browser options override, if present`)

### Describe the solution you'd like

Ideally, as a developer, I'd like to have better control over the browser provider configuration, instead of having it implicitly overridden on the builder side.

These are the options that I have on my mind, both of them backward compatible with the existing API:

1. Allow full customization for the browser provider

The solution is as simple as not overriding the provider value if defined explicitly in `vitetest-base.config.ts`. This option would be backward compatible with the existing API, but might break the projects that've attempted to override the provider property and haven't noticed that it has no impact.

2. Add `wsEndpoint` property to the builder schema, and allow overriding the value from `angular.json`

Safer solution, but less flexible.

### Describe alternatives you've considered

All other alternatives require significant efforts to support, and require bypassing the Angular builders, or using a different framework for the same purpose.

I'm also happy to make a contribution, but first, I'd like to get an opinion, and maybe get more context on why the browser config is overridden from Angular's side.

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

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

調査の方向性

まず browser-provider.ts の 164~187 行付近、特に providerFactory を読み、次に plugins.ts の 265~284 行付近にある provider の上書きを確認します。Playwright の設定が Angular builder に到達する経路を追い、どの後方互換オプションが適切かを判断します。明示的に設定された wsEndpoint が、暗黙的に上書きされずに尊重されれば完了です。

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

評価

技術スタック
angular, playwright, typescript
領域
build-system, testing-qa, tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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