Skip to content

Commit 1f59f26

Browse files
committed
test: add snapshot test for dot reporter coverage threshold
1 parent 402b748 commit 1f59f26

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
require('../../../common');
3+
const fixtures = require('../../../common/fixtures');
4+
const spawn = require('node:child_process').spawn;
5+
6+
spawn(
7+
process.execPath,
8+
[
9+
'--no-warnings',
10+
'--experimental-test-coverage',
11+
'--test-coverage-exclude=!test/**',
12+
'--test-coverage-lines=99',
13+
'--test-reporter', 'dot',
14+
fixtures.path('test-runner/coverage.js'),
15+
],
16+
{ stdio: 'inherit' },
17+
);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
invalid tap output
2+
.
3+
ℹ Error: 78.35% 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.js | 78.65 | 38.46 | 60.00 | 12-13 16-22 27 39 43-44 61-62 66-67 71-72
12+
ℹ invalid-tap.js | 100.00 | 100.00 | 100.00 |
13+
ℹ v8-coverage | | | |
14+
ℹ throw.js | 71.43 | 50.00 | 100.00 | 5-6
15+
ℹ --------------------------------------------------------------------------------------------
16+
ℹ all files | 78.35 | 43.75 | 60.00 |
17+
ℹ --------------------------------------------------------------------------------------------
18+
ℹ end of coverage report
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Test that the output of test-runner/output/dot_reporter_coverage_threshold.js matches
2+
// test-runner/output/dot_reporter_coverage_threshold.snapshot
3+
import * as common from '../common/index.mjs';
4+
import * as fixtures from '../common/fixtures.mjs';
5+
import { spawnAndAssert, specTransform, 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_threshold.js'),
14+
specTransform,
15+
);

0 commit comments

Comments
 (0)