Skip to content

Commit 3be8bad

Browse files
committed
adds a snapshot test
1 parent b7cd703 commit 3be8bad

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Flags: --experimental-test-coverage --test-coverage-lines=99
2+
// here we can't import common module as the coverage will be different based on the system
3+
// Unused imports are here in order to populate the coverage report
4+
// eslint-disable-next-line no-unused-vars
5+
import * as a from '../coverage-snap/b.js';
6+
// eslint-disable-next-line no-unused-vars
7+
import * as b from '../coverage-snap/a.js';
8+
9+
import { test } from 'node:test';
10+
11+
process.stdout.columns = 80;
12+
13+
test('passing test for dot coverage report');
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.
2+
3+
ℹ Error: *% line coverage does not meet threshold of 99%.
4+
ℹ start of coverage report
5+
ℹ ------------------------------------------------------------------------------
6+
ℹ file | line % | branch % | funcs % | uncovered lines
7+
ℹ ------------------------------------------------------------------------------
8+
ℹ test | | | |
9+
ℹ fixtures | | | |
10+
ℹ test-runner | | | |
11+
ℹ coverage-snap | | | |
12+
ℹ a.js | 55.77 | 100.00 | 0.00 | 5-7 9-11 13-15 17-…
13+
ℹ b.js | 45.45 | 100.00 | 0.00 | 5-7 9-11
14+
ℹ output | | | |
15+
ℹ dot_reporter_cove….mjs | 100.00 | 100.00 | 100.00 |
16+
ℹ ------------------------------------------------------------------------------
17+
ℹ all files | 61.84 | 100.00 | 0.00 |
18+
ℹ ------------------------------------------------------------------------------
19+
ℹ end of coverage report
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Test that the output of test-runner/output/dot_reporter_coverage.mjs matches
2+
// test-runner/output/dot_reporter_coverage.snapshot
3+
import * as common from '../common/index.mjs';
4+
import * as fixtures from '../common/fixtures.mjs';
5+
import { spawnAndAssert, defaultTransform, ensureCwdIsProjectRoot } from '../common/assertSnapshot.js';
6+
7+
if (!process.features.inspector) {
8+
common.skip('inspector support required');
9+
}
10+
11+
ensureCwdIsProjectRoot();
12+
await spawnAndAssert(
13+
fixtures.path('test-runner/output/dot_reporter_coverage.mjs'),
14+
defaultTransform,
15+
{ flags: ['--test-reporter=dot', '--test-coverage-exclude=!test/**'] },
16+
);

0 commit comments

Comments
 (0)