test_runner: source-mapped coverage marks an unexecuted return as covered
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 66/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, node.js
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- JavaScript
- Estrelas
- 123k
- Forks
- 39.3k
- Merge médio
- 4d 16h
- PRs com merge (30d)
- 227
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de nodejs/node
-
http2: content-encoding is incorrectly listed in kSingleValueHeadersTalvez já em andamento @inoway46 assumiu há 1 dia. Abertaconfirmed-bug http2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
nodejs/node#67151 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
util.parseEnv and --env-file keep a leading UTF-8 BOM in the first keyTalvez já em andamento @helmipradita assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
node:internal/inspector/network_http: `TypeError: Missing dataLength` in event when response uses `setEncoding()`Talvez livre de novo Um pull request para esta issue foi fechado sem ser mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
nodejs/node#66551 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[Docs] `process.loadEnvFile()` does not document behaviour when variables already existTalvez já em andamento @Sepandard assumiu há 37 dias. Abertadoc
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
Mantenedores costumam responder em até 1 dia
-
Stream.prototype.forEach will block in first promise in queue before read more chunkTalvez já em andamento @mmustafasenoglu assumiu há 37 dias. Abertadoc
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 1 dia
Todas as issues de nodejs/node
Issues semelhantes
-
Site Suggestion: bullseyeAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 1 dia
-
Add toro4n to the data modeling toolsTalvez já em andamento @henriklantzhedstrom-prog assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 62/100
neo4j/docs-getting-started#546 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
Mantenedores costumam responder em até 25 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
libnativeapi/nativeapi#21 ·
-
area: core complexity: easy impact: medium
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
ueberdosis/tiptap#8668 ·
Mantenedores costumam responder em até 1 dia