Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Cerrado Apto para principiantes
#43,533 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@CloneOfAlex ya está trabajando en esto.

Desde el 19/10/2026.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, playwright, typescript
Área
cli, testing

Línea de trabajo

Empieza en packages/playwright/src/cli/testActions.ts, en overridesFromOptions(), e inspecciona cómo se analizan las cinco opciones numéricas de CLI; compáralo con la validación en configLoader.ts. Añade pruebas específicas para valores malformados y válidos, y luego ejecútalas. Se considera terminado cuando los valores no válidos producen un mensaje de uso claro y los enteros no negativos válidos siguen funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
TypeScript
Estrellas
98k
Forks
6.6k
Merge medio
16 h 20 min
PR fusionados (30 d)
301

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/playwright

Todos los issues de microsoft/playwright

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.