test_runner: change-aware test selection
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
Línea de trabajo
Comienza con el punto de entrada node --test, la implementación existente de --watch y run({ files }); después, sigue el resolver utilizado por el ejecutor de pruebas. Se considera terminado cuando se seleccionen las pruebas mediante dependencias de módulos estáticas, mientras que las pruebas con dependencias opacas o cambios globales de paquetes se ejecuten de forma conservadora, con cobertura para los casos CJS y de dependencias invisibles indicados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What is the problem this feature will solve?
node --test always runs every test file. There is no way to run only the tests affected by a change.
--watch does this, but only while it stays running. CI, a pre-commit hook, or a branch diff all start cold and run everything.
Jest (--onlyChanged) and Vitest (--changed) both do this.
What is the feature you are proposing to solve the problem?
Run only the test files whose module graph reaches a given set of files.
$ node --test --related=src/util.ts # tests that depend on a file
$ git diff --name-only | node --test --related=- # tests affected by a change
Graph-aware, not path-based: a test that imports a module that imports the changed file is selected. Conservative by default, so anything the graph cannot see has to run, and a change to package.json or a lockfile disables filtering entirely.
Paths rather than a --changed=<rev> flag, because that would mean core shelling out to git. There is no VCS dependency anywhere in lib/ today and I don't think this justifies introducing one. --changed can be layered on later if the team wants it.
Things to figure out
- CJS. Static imports can be extracted from an ES module without executing it. There is no equivalent for
require(), since the bundled lexer reports exports rather than requires. CJS files would be opaque: any test reaching one always runs. Correct, but a CJS-heavy project gets little out of this. - Invisible dependencies. A test that reads a fixture with
fs, or uses dynamicimport(), cannot be selected statically. Those have to resolve to "run it".
Under-selection is the failure mode that matters. Silently skipping a test the change broke is worse than not having the feature.
What alternatives have you considered?
Userland: a wrapper computing the list and passing it to run({ files }). Every such tool has to reimplement module resolution, and gets TypeScript, subpath imports and node_modules boundaries subtly wrong. The resolver is already in core.
--test-rerun-failures covers rerunning what failed, not running what a change could break.
cc @nodejs/test_runner
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.4k
- Merge medio
- 4 d 4 h
- PR fusionados (30 d)
- 276
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nodejs/node
-
doc
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
build
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
-
feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Todos los issues de nodejs/node
Issues similares
-
bug customer-eng Durable Agents Inngest status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
optimization optimization:agents-md-curator
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
AOSSIE-Org/OrgExplorer#253 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100