Skip to content

Commit 402b748

Browse files
committed
test: add dot reporter coverage threshold tests
1 parent 313a274 commit 402b748

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/parallel/test-runner-coverage-thresholds.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,25 @@ for (const coverage of coverages) {
170170
assert.strictEqual(result.status, 1);
171171
assert(!findCoverageFileForPid(result.pid));
172172
});
173+
174+
test(`test failing ${coverage.flag} with dot reporter`, () => {
175+
const result = spawnSync(process.execPath, [
176+
'--test',
177+
'--experimental-test-coverage',
178+
'--test-coverage-exclude=!test/**',
179+
`${coverage.flag}=99`,
180+
'--test-reporter', 'dot',
181+
fixture,
182+
]);
183+
184+
const stdout = result.stdout.toString();
185+
assert.match(
186+
stdout,
187+
RegExp(`Error: ${coverage.actual.toFixed(2)}% ${coverage.name} coverage does not meet threshold of 99%`)
188+
);
189+
assert.match(stdout, /start of coverage report/);
190+
assert.match(stdout, /end of coverage report/);
191+
assert.strictEqual(result.status, 1);
192+
assert(!findCoverageFileForPid(result.pid));
193+
});
173194
}

0 commit comments

Comments
 (0)