Note: This project is somewhat unstable. It also requires use of an nyc fork in order to get options passed to it.
npm i -D nyc-line-visit-count-reporter
Note that for this reporter to work, you cannot set instrument
to false
.
For running tests, e.g., with Mocha:
nyc --reporter-options <option1=val1> --reporter-options <option2=val2> --reporter nyc-line-visit-count-reporter npm run mocha
For reporting on results after the fact:
nyc report --reporter-options <option1=val1> --reporter-options <option2=val2> --reporter nyc-line-visit-count-reporter
For example, running the this command:
nyc --reporter nyc-line-visit-count-reporter mocha --recursive --require @babel/register --reporter progress --timeout 9000
...against the project eslint-plugin-jsdoc
currently gives:
Whether to show absolute paths instead of paths relative to the current working directory.
Defaults to false
.
How many items to display. Defaults to 10
.
A single relative file path (relative to the coverage directory) to which to
write the output. Defaults to null
(i.e., writes to console.
File, semi-colon-separated list of files, or array of files to be reported on.
Defaults to not being used.
Whether to avoid calculating maxItems
relative to the results across
files in aggregate rather than per file.
If true
, will group the items by file, with each group listing the
number of maxItems
per file group.
If false
, will only list one set (limited by maxItems
), sorting
exclusively by visit count (though listing file name for each entry).
The available file groups will be all covered files unless file
is set.
Defaults to false
.
- Get tests working consistently with coverage
- See about avoiding need for fork
--reporter-options
; see nyc PR# 1312.
- Interactive mode where one can selectively open files (with line/column as IDEs such as Atom understand) by number.
- Could add
es6-template-strings
to allow user to control appearance - Discuss global installation (esp. with
nyc report
which doesn't require knowing exact testing requirements)? - Others data besides on statements:
- Top visited functions (or the function within which a
statement occurs) along with the function
name
.line
andcolumn
ofloc.start
andloc.end
(ordecl.start
anddecl.end
?) - Top visited branches, along with its
type
(e.g., switch) and whether it was for anif
orelse
(the first or second item in theb
array).line
andcolumn
ofloc.start
andloc.end
(shouldn't needlocations
which list locations of all branches, e.g., of a switch or if-else)
- Top visited functions (or the function within which a
statement occurs) along with the function