Allow custom wsEndpoint for Playwright
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 14 小時 23 分鐘
- 30 天內合併 PR
- 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