Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug]: CLI numeric options are not validated: `--timeout 30s` runs with a 30ms timeout, `--timeout abc` / `--retries abc` silently disable timeouts and retries

クローズ 初心者向け
#43,533 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

@CloneOfAlex がすでに取り組んでいます。

2026年10月19日 から。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, playwright, typescript
領域
cli, testing

調査の方向性

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);
});
  1. npx playwright test tests/a.spec.ts --timeout 30s
  2. npx 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
  1. The test fails with Test timeout of 30ms exceeded. because "30s" is read as 30 ms. --timeout 1m likewise becomes a 1 ms timeout.
  2. The run prints timeout=null retries=null and 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

環境構築

はじめの一歩

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

microsoft/playwright のほかの issue

microsoft/playwright の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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