Commit 6119289
test_runner: add initial code coverage support
This commit adds code coverage functionality to the node:test
module. When node:test is used in conjunction with the new
--test-coverage CLI flag, a coverage report is created when
the test runner finishes. The coverage summary is forwarded to
any test runner reporters so that the display can be customized
as desired. This new functionality is compatible with the
existing NODE_V8_COVERAGE environment variable as well.
There are still several limitations, which will be addressed in
subsequent pull requests:
- Coverage is only reported for a single process. It is possible
to merge coverage reports together. Once this is done, the
--test flag will be supported as well.
- Source maps are not currently supported.
- Excluding specific files or directories from the coverage
report is not currently supported. Node core modules and
node_modules/ are excluded though.
PR-URL: #46017
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>1 parent c9d5dfd commit 6119289Copy full SHA for 6119289
File tree
Expand file treeCollapse file tree
16 files changed
+796
-33
lines changedOpen diff view settings
Filter options
- doc
- api
- lib/internal
- process
- test_runner
- reporter
- src
- test
- fixtures/test-runner
- parallel
Expand file treeCollapse file tree
16 files changed
+796
-33
lines changedOpen diff view settings
Collapse file
+12Lines changed: 12 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1228 | 1228 | |
1229 | 1229 | |
1230 | 1230 | |
| 1231 | + |
| 1232 | + |
| 1233 | + |
| 1234 | + |
| 1235 | + |
| 1236 | + |
| 1237 | + |
| 1238 | + |
| 1239 | + |
| 1240 | + |
| 1241 | + |
1231 | 1242 | |
1232 | 1243 | |
1233 | 1244 | |
| ||
2346 | 2357 | |
2347 | 2358 | |
2348 | 2359 | |
| 2360 | + |
2349 | 2361 | |
2350 | 2362 | |
2351 | 2363 | |
|
Collapse file
+87Lines changed: 87 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
368 | 368 | |
369 | 369 | |
370 | 370 | |
| 371 | + |
| 372 | + |
| 373 | + |
| 374 | + |
| 375 | + |
| 376 | + |
| 377 | + |
| 378 | + |
| 379 | + |
| 380 | + |
| 381 | + |
| 382 | + |
| 383 | + |
| 384 | + |
| 385 | + |
| 386 | + |
| 387 | + |
| 388 | + |
| 389 | + |
| 390 | + |
| 391 | + |
| 392 | + |
| 393 | + |
| 394 | + |
| 395 | + |
| 396 | + |
| 397 | + |
| 398 | + |
| 399 | + |
| 400 | + |
| 401 | + |
| 402 | + |
| 403 | + |
| 404 | + |
| 405 | + |
| 406 | + |
| 407 | + |
| 408 | + |
| 409 | + |
| 410 | + |
| 411 | + |
| 412 | + |
| 413 | + |
| 414 | + |
| 415 | + |
| 416 | + |
| 417 | + |
| 418 | + |
371 | 419 | |
372 | 420 | |
373 | 421 | |
| ||
1215 | 1263 | |
1216 | 1264 | |
1217 | 1265 | |
| 1266 | + |
| 1267 | + |
| 1268 | + |
| 1269 | + |
| 1270 | + |
| 1271 | + |
| 1272 | + |
| 1273 | + |
| 1274 | + |
| 1275 | + |
| 1276 | + |
| 1277 | + |
| 1278 | + |
| 1279 | + |
| 1280 | + |
| 1281 | + |
| 1282 | + |
| 1283 | + |
| 1284 | + |
| 1285 | + |
| 1286 | + |
| 1287 | + |
| 1288 | + |
| 1289 | + |
| 1290 | + |
| 1291 | + |
| 1292 | + |
| 1293 | + |
| 1294 | + |
| 1295 | + |
| 1296 | + |
| 1297 | + |
| 1298 | + |
| 1299 | + |
| 1300 | + |
| 1301 | + |
1218 | 1302 | |
1219 | 1303 | |
1220 | 1304 | |
| ||
1595 | 1679 | |
1596 | 1680 | |
1597 | 1681 | |
| 1682 | + |
1598 | 1683 | |
1599 | 1684 | |
1600 | 1685 | |
| ||
1603 | 1688 | |
1604 | 1689 | |
1605 | 1690 | |
| 1691 | + |
1606 | 1692 | |
1607 | 1693 | |
1608 | 1694 | |
| ||
1613 | 1699 | |
1614 | 1700 | |
1615 | 1701 | |
| 1702 | + |
1616 | 1703 | |
Collapse file
+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
391 | 391 | |
392 | 392 | |
393 | 393 | |
| 394 | + |
| 395 | + |
| 396 | + |
394 | 397 | |
395 | 398 | |
396 | 399 | |
|
Collapse file
lib/internal/process/pre_execution.js
Copy file name to clipboardExpand all lines: lib/internal/process/pre_execution.js+13-30Lines changed: 13 additions & 30 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
20 | 20 | |
21 | 21 | |
22 | 22 | |
| 23 | + |
23 | 24 | |
24 | 25 | |
25 | 26 | |
| ||
66 | 67 | |
67 | 68 | |
68 | 69 | |
69 | | - |
70 | | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
| 70 | + |
78 | 71 | |
79 | 72 | |
80 | 73 | |
| ||
304 | 297 | |
305 | 298 | |
306 | 299 | |
| 300 | + |
| 301 | + |
| 302 | + |
| 303 | + |
| 304 | + |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
307 | 311 | |
308 | 312 | |
309 | 313 | |
| ||
315 | 319 | |
316 | 320 | |
317 | 321 | |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | | - |
339 | 322 | |
340 | 323 | |
341 | 324 | |
|
0 commit comments