[Feature]: expose per-project workers on FullProject for reporters

未关闭 适合新手
#44,264 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
playwright, typescript
领域
testing-qa

调研方向

阅读公开类型 FullProject 及其从 FullProjectInternal 构建的方式;issue 指出,其中的 workers 已通过 resolveWorkers 解析。比较 FullConfig.workers 和 failOnFlakyTests 的公开方式,然后检查相关的 reporter 或项目类型测试。当 reporter 能通过公开的 project 对象读取每个项目已解析的 worker 限额时,即为完成,包括文档说明的 undefined 情况。

由索引模型根据 Issue 内容生成。

描述

agent-triage-done
🚀 Feature Request

Add workers to FullProject, resolved to a number the same way FullConfig.workers is. TestProject.workers lets a project cap its own concurrency, but a reporter only sees the global FullConfig.workers. Today the only way to read a project's limit is the internal config behind configInternalSymbol, which can change in any release. This is similar to failOnFlakyTests, which was added to FullConfig in 1.61 (#40918).

The resolved value already exists as FullProjectInternal.workers (via resolveWorkers, including the --debug override); this would expose it on the public project object.

Example
class MyReporter implements Reporter {
  onBegin(config: FullConfig, suite: Suite) {
    for (const project of config.projects) {
      // undefined when the project doesn't set its own limit
      console.log(project.name, project.workers ?? config.workers);
    }
  }
}

With this config:

export default defineConfig({
  workers: 10,
  projects: [
    { name: 'stateful', workers: 1 },
    { name: 'chromium' },
  ],
});

the reporter would print stateful 1 and chromium 10.

Motivation

Reporters that plan or split work across machines need each project's concurrency limit. A project limited to one worker should be handed tests in smaller batches than one that runs ten workers in parallel. Without a public field, these reporters read Playwright's internal config, and an internal refactor breaks them.

主要语言
TypeScript
星标
100k
派生
6.9k
平均合并
16 小时 8 分钟
30 天内合并 PR
281

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/playwright 的其他 Issue

查看 microsoft/playwright 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。