node/test/fixtures/v8-coverage/combined_coverage/common.js
cjihrig b31d587dc8
test_runner: support combining coverage reports
This commit adds support for combining code coverage reports
in the test runner. This allows coverage to be collected for
child processes, and by extension, the test runner CLI.

PR-URL: https://github.com/nodejs/node/pull/47686
Fixes: https://github.com/nodejs/node/issues/47669
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-04-28 13:13:53 +00:00

69 lines
827 B
JavaScript

'use strict';
function fnA() {
let cnt = 0;
try {
cnt++;
throw new Error('boom');
cnt++;
} catch (err) {
cnt++;
} finally {
if (false) {
}
return cnt;
}
cnt++;
}
function fnB(arr) {
for (let i = 0; i < arr.length; ++i) {
if (i === 2) {
continue;
} else {
fnE(1);
}
}
}
function fnC(arg1, arg2) {
if (arg1 === 1) {
if (arg2 === 3) {
return -1;
}
if (arg2 === 4) {
return 3;
}
if (arg2 === 5) {
return 9;
}
}
}
function fnD(arg) {
let cnt = 0;
if (arg % 2 === 0) {
cnt++;
} else if (arg === 1) {
cnt++;
} else if (arg === 3) {
cnt++;
} else {
fnC(1, 5);
}
return cnt;
}
function fnE(arg) {
const a = arg ?? 5;
return a;
}
module.exports = { fnA, fnB, fnC, fnD, fnE };