nodejs / nodejs/node

test runner (--test, node:test) subtest test context lack `.skip`, `.only` and `.todo` functions

Abierto
#50,665 6 comentarios 5 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

confirmed-bug test_runner
Lenguaje dominante
JavaScript
Estrellas
122k
Forks
37.4k
Merge medio
4 d 2 h
PR fusionados (30 d)
283

Descripción

Version

20.7.0

Platform

Linux void-desktop 6.5.9_1 #1 SMP PREEMPT_DYNAMIC Thu Oct 26 12:11:50 UTC 2023 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?
const test = require('node:test');

test('Parent', t => {
	t.test.only('Child only', () => {});
	t.test.skip('Child skip', () => {});
	t.test.todo('Child todo', () => {});
});

Run with node --test <file> (same result without the --test flag)

How often does it reproduce? Is there a required condition?

Consistently

What is the expected behavior? Why is that the expected behavior?

All functions work as described here: https://nodejs.org/docs/latest-v20.x/api/test.html#subtests

This method behaves identically to the top level test() function. The following example demonstrates the creation of a top level test with two subtests.

What do you see instead?
TypeError [Error]: t.test.todo is not a function
TypeError [Error]: t.test.skip is not a function
TypeError [Error]: t.test.only is not a function
Additional information

These functions work for top-level test, they don't work for nested tests.
Maybe it doesn't make sense to expose those functions for subtests (use just describe - maybe it's enough), but in that case the documentation is misleading

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Comienza en el punto de entrada de la API de subtests de node:test y reproduce la prueba anidada proporcionada con node --test o sin la opción. Compara el comportamiento documentado de t.test.only, t.test.skip y t.test.todo con los TypeErrors observados; se considera terminado cuando el comportamiento de la API anidada y la documentación coinciden en el comportamiento previsto.

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

Evaluación

Stack tecnológico
javascript, node.js
Área
testing
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.