GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Coverage map issued on switch statements without scoped case clauses incorrectly report an uncovered block · Issue #53652 · nodejs/node Closed as not planned Closed as not planned Copy link Labels coverageIssues and PRs related to Node.js code coverage support.Issues and PRs related to Node.js code coverage support.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency. DescriptionVersionv20.13.0 PlatformSubsystemNo response What steps will reproduce the bug?Consider the following scripts:
export const foo = (value) => { switch (value) { case true: const result = 5; return result; default: return 10; } };
import {foo} from "./lib.mjs"; foo(false); foo(true); Executing the
The coverage map file, with only the two relevant scripts for readability: {
"result": [
{
"scriptId": "100",
"url": "file:///home/ericmorand/Projects/one-hundred-cases/src/switch-without-scoped-cases/index.mjs",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 54,
"count": 1
}
],
"isBlockCoverage": true
}
]
},
{
"scriptId": "101",
"url": "file:///home/ericmorand/Projects/one-hundred-cases/src/switch-without-scoped-cases/lib.mjs",
"functions": [
{
"functionName": "",
"ranges": [
{
"startOffset": 0,
"endOffset": 178,
"count": 1
}
],
"isBlockCoverage": true
},
{
"functionName": "foo",
"ranges": [
{
"startOffset": 19,
"endOffset": 176,
"count": 2
},
{
"startOffset": 61,
"endOffset": 128,
"count": 1
},
{
"startOffset": 137,
"endOffset": 168,
"count": 1
},
{
"startOffset": 174,
"endOffset": 175,
"count": 0
}
],
"isBlockCoverage": true
}
]
}
]
}How often does it reproduce? Is there a required condition?It happens only when using either:
The following variant of export const foo = (value) => { switch (value) { case true: return 5; default: return 10; } };
The following variant of export const foo = (value) => { switch (value) { case true: { const result = 5; return result; } default: { return 10; } } }; What is the expected behavior? Why is that the expected behavior?The entirety of What do you see instead?The range 174:175 is considered as uncovered: {
"startOffset": 174,
"endOffset": 175,
"count": 0
}Additional informationThis issues has been impacting c8, among other code coverage tools: Activity
MetadataMetadataAssigneesLabelscoverageIssues and PRs related to Node.js code coverage support.Issues and PRs related to Node.js code coverage support.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |