nyc-line-visit-count-reporter
v0.1.0
Published
Get visit counts of interest (e.g., top 10 most visited lines) with file and line number
Downloads
6
Readme
nyc-line-visit-count-reporter
Note: This project is somewhat unstable. It also requires use of an nyc fork in order to get options passed to it.
Installation
npm i -D nyc-line-visit-count-reporter
Usage
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
Reporter options
absolutePaths
Whether to show absolute paths instead of paths relative to the current working directory.
Defaults to false
.
maxItems
How many items to display. Defaults to 10
.
outputFile
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
File, semi-colon-separated list of files, or array of files to be reported on.
Defaults to not being used.
noAggregate
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
.
To-dos
- Get tests working consistently with coverage
- See about avoiding need for fork
--reporter-options
; see nyc PR# 1312.
Possible to-dos
- 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 - 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