forked from nodejs/node
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: nodejs#47686 Fixes: nodejs#47669 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
- Loading branch information
Showing
9 changed files
with
293 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
'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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
const { test } = require('node:test'); | ||
const common = require('./common'); | ||
|
||
function notCalled() { | ||
} | ||
|
||
test('first 1', () => { | ||
common.fnA(); | ||
common.fnD(100); | ||
common.fnB([1, 2, 3]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
const { test } = require('node:test'); | ||
const common = require('./common'); | ||
|
||
test('second 1', () => { | ||
common.fnB([1, 2, 3]); | ||
common.fnD(3); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
const { test } = require('node:test'); | ||
const common = require('./common'); | ||
|
||
test('third 1', () => { | ||
common.fnC(1, 4); | ||
common.fnD(99); | ||
}); |
Oops, something went wrong.