nodejs / nodejs/node

Slow performances when running tests with `--experimental-test-coverage`

Abierto
#55,103 12 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

coverage test_runner
Lenguaje dominante
JavaScript
Estrellas
122k
Forks
37.3k
Merge medio
4 d 2 h
PR fusionados (30 d)
283

Descripción

Version

v22.9.0

Platform
Darwin N4V4PGFGPT 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112 arm64
Subsystem

No response

What steps will reproduce the bug?

Run tests with --experimental-test-coverage option. Comparing it to other solutions (f.e. running Node tests and getting the coverage with nyc) this is way slower. For instance, on a repo with ~800 tests, collecting coverage with nyc takes 77s, while running with --experimental-test-coverage takes 148s.

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

I can reproduce it every time I run the Node tests with the native test coverage option.

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

The performances should be at least equal (ideally better) than with 3rd party dependencies (like nyc).

What do you see instead?

An average time spent per test of 185ms vs 96ms.

Additional information

I tried running with/without additional options (f.e. --test-coverage-exclude, --test-coverage-include, --test-coverage-branches, --test-coverage-functions, --test-coverage-lines) but it didn't help. The performance issue seems only to be related to the algorithm that's triggered by the --experimental-test-coverage option.

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 reproduciendo los tiempos indicados con un conjunto de pruebas de aproximadamente 800 pruebas, comparando --experimental-test-coverage con nyc y las opciones de cobertura enumeradas. Rastrea el algoritmo de cobertura activado por la opción nativa; el trabajo estará terminado cuando la cobertura siga siendo correcta y su rendimiento se acerque sustancialmente al de la comparación.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.