connor4312 / connor4312/nodejs-testing

No branch coverage

Open
#40 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
67
Forks
15
PR merge metrics
No merged PRs in 30d

Description

I'm unable to see any branch coverage in the "test coverage" pane. I only see statement and function coverage.

I've created a minimal example to reproduce this.

```js
// main.mjs
export function foo(arg) {
return arg ? 1 : 2; // Two branches
}
```

```js
// main.test.mjs
import { test } from 'node:test';
import { strict as assert } from 'node:assert';
import { foo } from './main.mjs';

test('test', () => {
assert.equal(foo(true), 1); // Only one branch tested
});
```

I click "run tests with coverage" in the testing panel.

The coverage breakdown doesn't show branches:

![image](https://github.com/connor4312/nodejs-testing/assets/2261100/592f46f8-ff66-4119-93ad-45d679bb34af)

If I hover over it, it says "0/0" branches covered:

![image](https://github.com/connor4312/nodejs-testing/assets/2261100/2d98a969-a19f-4028-879f-de6085dddfe0)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the report with main.mjs and main.test.mjs, then run the tests with coverage from the VS Code testing panel. Inspect how the coverage breakdown represents the two branches in foo; done means the pane reports branch coverage rather than 0/0 while preserving statement and function coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript, vscode
Domain
devtools, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.