Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Minimal reproduction for node test runner coverage questions

Notifications You must be signed in to change notification settings

swantzter/poc-node-test-coverage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  1. Run npm t - alias to node --test --experimental-test-coverage --test-coverage-include='*.js' --test-coverage-exclude='*.test.js'

  2. Get the following output:

TAP version 13
# Subtest: Add function
    # Subtest: Adds two numbers
    ok 1 - Adds two numbers
      ---
      duration_ms: 0.9237
      ...
    1..1
ok 1 - Add function
  ---
  duration_ms: 2.0894
  ...
1..1
# tests 2
# suites 0
# pass 2
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 65.412201
# start of coverage report
# -------------------------------------------------------
# file   | line % | branch % | funcs % | uncovered lines
# -------------------------------------------------------
# add.js | 100.00 |   100.00 |  100.00 | 
# -------------------------------------------------------
# all f… | 100.00 |   100.00 |  100.00 |
# -------------------------------------------------------
# end of coverage report
  1. Focus in on the coverage report - only add.js is listed

  2. Expected:

# ------------------------------------------------------------
# file        | line % | branch % | funcs % | uncovered lines
# ------------------------------------------------------------
# add.js      | 100.00 |   100.00 |  100.00 |
# subtract.js |   0.00 |     0.00 |    0.00 | 1-3
# ------------------------------------------------------------
# all files   |  50.00 |    50.00 |   50.00 |
# ------------------------------------------------------------
# end of coverage report

About

Minimal reproduction for node test runner coverage questions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published