test_runner: source-mapped coverage marks an unexecuted return as covered
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 66/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, node.js
Línea de trabajo
Start by running the reproduction with Node.js source maps and test coverage enabled, then compare its report with the same file after removing the source-map comment. Trace how the test runner maps executed JavaScript coverage back to the embedded TypeScript source; the issue gives no implementation file or test path, so first locate the coverage and source-map tests. Done means the uncovered return is reported as uncovered in both the text and lcov reports.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version
v26.12.1
Platform
Darwin arm64
Subsystem
test_runner coverage
Reproduction
Create these two files in an empty directory. No packages or module hooks are required. The inline source map contains its TypeScript source.
compiled.mjs
function choose(value) {
if (value) {
return "yes";
}
return "no";
}
export {
choose
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiZXhhbXBsZS50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiZXhwb3J0IGZ1bmN0aW9uIGNob29zZSh2YWx1ZTogYm9vbGVhbik6IHN0cmluZyB7XG4gIGlmICh2YWx1ZSkge1xuICAgIHJldHVybiBcInllc1wiO1xuICB9XG4gIHJldHVybiBcIm5vXCI7XG59XG4iXSwKICAibWFwcGluZ3MiOiAiQUFBTyxTQUFTLE9BQU8sT0FBd0I7QUFDN0MsTUFBSSxPQUFPO0FBQ1QsV0FBTztBQUFBLEVBQ1Q7QUFDQSxTQUFPO0FBQ1Q7IiwKICAibmFtZXMiOiBbXQp9Cg==
compiled.test.mjs
import assert from "node:assert/strict";
import test from "node:test";
import { choose } from "./compiled.mjs";
test("branch", () => assert.equal(choose(true), "yes"));
Run:
node --enable-source-maps --experimental-test-coverage --test compiled.test.mjs
The embedded original source is:
export function choose(value: boolean): string {
if (value) {
return "yes";
}
return "no";
}
Expected behavior
The test only calls choose(true). Original line 5 (return "no") should be uncovered. With the source-map comment removed, the JavaScript report correctly shows line 5 uncovered.
Actual behavior
The source-mapped report shows example.ts at 100% lines, 66.67% branches, and 100% functions, with no uncovered lines. The lcov reporter also emits DA:5,1. This overstates execution of a branch that the test never takes.
This reproduces with a single test process and a precompiled module. The example was generated using esbuild 0.28.2, but the reproduction above does not require esbuild. Related source-map coverage reports include #65946 and #67077; those describe off-thread hooks or merging multiple test processes, while this case needs neither.
- Lenguaje dominante
- JavaScript
- Estrellas
- 123k
- Forks
- 39.3k
- Merge medio
- 4 d 11 h
- PR fusionados (30 d)
- 237
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la 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
-
util: parseArgs() treats a `-` inside a short option group as the `--` terminatorPosiblemente ocupada @yohannesjoya la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
http2: content-encoding is incorrectly listed in kSingleValueHeadersPosiblemente ocupada @inoway46 la tomó hace 3 días. Abiertoconfirmed-bug http2
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
nodejs/node#67151 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
util.parseEnv and --env-file keep a leading UTF-8 BOM in the first keyPosiblemente ocupada @helmipradita la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
node:internal/inspector/network_http: `TypeError: Missing dataLength` in event when response uses `setEncoding()`Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nodejs/node#66551 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Docs] `process.loadEnvFile()` does not document behaviour when variables already existPosiblemente ocupada @Sepandard la tomó hace 39 días. Abiertodoc
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
Todos los issues de nodejs/node
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
ai-driven-fuzzing bug Cosmetic
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
linagora/cozy-client#1831 ·
Los mantenedores suelen responder en 1 día
-
ai-driven-fuzzing bug Major
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
[ordering-review] workshop order graph: 1 confirmed ordering problem, 3 cycles are false positivesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
githubnext/gh-aw-workshop#5331 ·
Los mantenedores suelen responder en 1 día
-
Remove: 21 SexturyAbiertochannels:remove check:passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
Los mantenedores suelen responder en 4 días