[Bug]: CLI numeric options are not validated: `--timeout 30s` runs with a 30ms timeout, `--timeout abc` / `--retries abc` silently disable timeouts and retries
メンテナーはふだん 1 日以内に返信
@CloneOfAlex がすでに取り組んでいます。
2026年10月19日 から。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, playwright, typescript
調査の方向性
packages/playwright/src/cli/testActions.ts の overridesFromOptions() から始めて、5つの数値 CLI オプションがどのように解析されるかを調べ、configLoader.ts の検証と比較してください。不正な値と有効な値を対象にした絞り込んだテストを追加し、そのテストを実行してください。無効な値で明確な使用方法エラーが表示され、有効な非負整数が引き続き機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Version
1.64.1 (also reproduces on main at cdcef0b)
Steps to reproduce
No browser needed. Fresh project with npm i -D @playwright/[email protected] and two files:
// tests/a.spec.ts
import { test } from '@playwright/test';
test('waits 200ms', async () => { await new Promise(f => setTimeout(f, 200)); });
// tests/d.spec.ts
import { test } from '@playwright/test';
test('reports config', async ({}, testInfo) => {
console.log('timeout=' + testInfo.timeout + ' retries=' + testInfo.project.retries);
});
npx playwright test tests/a.spec.ts --timeout 30snpx playwright test tests/d.spec.ts --timeout abc --retries abc
Expected behavior
Both commands fail fast with a usage error, the same way invalid config-file values are rejected (config.timeout must be a non-negative number). For example: --timeout "30s" must be a non-negative integer.
Actual behavior
- The test fails with
Test timeout of 30ms exceeded.because"30s"is read as 30 ms.--timeout 1mlikewise becomes a 1 ms timeout. - The run prints
timeout=null retries=nulland passes with exit code 0. The run has no test timeout and no retries, with no warning.
The same applies to --global-timeout, --repeat-each and --max-failures.
Additional context
Root cause: overridesFromOptions() in packages/playwright/src/cli/testActions.ts uses parseInt(value, 10) for --timeout, --global-timeout, --retries, --repeat-each and --max-failures. parseInt('30s') is 30, and parseInt('abc') is NaN. NaN is serialized as null over IPC, and !slot.timeout then means "no timeout". Values from the config file are validated in configLoader.ts, but CLI overrides are not.
I have a fix with tests ready: a strict non-negative-integer check that throws a clear usage error. Happy to open a PR if that approach works for you.
Environment
System:
OS: Linux 6.18 Ubuntu 24.04.5 LTS (Noble Numbat)
CPU: (2) x64 Intel(R) Xeon(R) Processor @ 2.10GHz
Memory: 7.84 GB
Container: Yes
Binaries:
Node: 22.22.0
npm: 10.9.4
npmPackages:
@playwright/test: 1.64.1
- 主要言語
- TypeScript
- スター
- 98.5k
- フォーク
- 6.7k
- 平均マージ
- 16時間 10分
- マージ済み PR(30日)
- 305
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/playwright のほかの issue
-
[Bug]: Uncaught TypeError in captureSecurityDetails when APIRequestContext reuses a destroyed keep-alive socket対応中かも @microsoft-playwright-automation が今日担当しました。 オープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/playwright#43728 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: Set `this.name` in `TargetClosedError` constructor再び着手できるかも @LeonxLJX が 55 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンP3-collecting-feedback
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
microsoft/playwright#42522 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
microsoft/playwright#43738 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 42/100
microsoft/playwright#43715 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
microsoft/playwright#43711 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/playwright の issue をすべて見る
似ている issue
-
e2e-failure ready-to-code
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
redhat-developer/rhdh-plugin-export-overlays#4616 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
ai-handle
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nextlevelbuilder/dewee-web-v2#73 ·
メンテナーはふだん 1 日以内に返信
-
backend bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
PoCInnovation/Distribox#255 ·
メンテナーはふだん 1 日以内に返信