[Feature]: Test runner captures and source-maps stacks that it never uses

オープン
#44,334 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@microsoft-playwright-automation がすでに取り組んでいます。

2026年11月24日 から。

  • #44338 @microsoft-playwright-automation による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
30/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript

調査の方向性

Start in fixtureRunner.ts where _stepInfo.stack is set for built-in fixture steps, and in packages/isomorphic/manualPromise.ts at LongStandingScope._race(). Read closed PR #44326 for the already-tested implementation, then run the test-runner and manual-promise tests covering step metadata and close-error stacks. Done means built-in fixture steps carry stack: [], _race() reads .stack only when cloning a close error, and existing stack output stays unchanged.

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

説明

agent-triage-done
Problem

Two hot paths in the worker format stacks that nobody reads:

  1. Built-in fixture steps (page, context, request, and about 30 more) have no user location. In fixtureRunner.ts, _stepInfo.stack is undefined, so testInfo._addStep() captures and source-maps a full raw stack, then filters it to 0 frames. This happens about 60 times per test.
  2. LongStandingScope._race() in packages/isomorphic/manualPromise.ts reads new Error().stack on every call. The formatted stack is used only when the scope closes during the race.
Measurements

CPU profile of a 24-test suite, Apple Silicon, Chromium headless shell, 1 worker, median of 5 runs:

Now With both changes
Worker CPU time 995 ms 806 ms (−19%)
Proposed approach
  1. Give built-in fixture steps stack: []. User fixtures keep their registration location.
  2. In _race(), keep the Error and read .stack only when it clones a close error. V8 records the frames when the Error is constructed, so close messages stay the same.

One difference: built-in fixture steps no longer report user locations injected by a custom Error.prepareStackTrace formatter. With the default formatter, they never had a location.

Already implemented and tested in #44326, which was closed only to file this issue first. Both are small, low-risk performance fixes. Reopening #44326 is the fastest path; it is ready for review.

主要言語
TypeScript
スター
100k
フォーク
6.9k
平均マージ
16時間 18分
マージ済み PR(30日)
281

環境構築

はじめの一歩

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

microsoft/playwright のほかの issue

microsoft/playwright の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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