Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | # istanbul-lib-report
|
---|
2 |
|
---|
3 | [![Greenkeeper badge](https://badges.greenkeeper.io/istanbuljs/istanbul-lib-report.svg)](https://greenkeeper.io/)
|
---|
4 | [![Build Status](https://travis-ci.org/istanbuljs/istanbul-lib-report.svg?branch=master)](https://travis-ci.org/istanbuljs/istanbul-lib-report)
|
---|
5 |
|
---|
6 | Core reporting utilities for istanbul.
|
---|
7 |
|
---|
8 | ## Example usage
|
---|
9 |
|
---|
10 | ```js
|
---|
11 | const libReport = require('istanbul-lib-report');
|
---|
12 | const reports = require('istanbul-reports');
|
---|
13 |
|
---|
14 | // coverageMap, for instance, obtained from istanbul-lib-coverage
|
---|
15 | const coverageMap;
|
---|
16 |
|
---|
17 | const configWatermarks = {
|
---|
18 | statements: [50, 80],
|
---|
19 | functions: [50, 80],
|
---|
20 | branches: [50, 80],
|
---|
21 | lines: [50, 80]
|
---|
22 | };
|
---|
23 |
|
---|
24 | // create a context for report generation
|
---|
25 | const context = libReport.createContext({
|
---|
26 | dir: 'report/output/dir',
|
---|
27 | // The summarizer to default to (may be overridden by some reports)
|
---|
28 | // values can be nested/flat/pkg. Defaults to 'pkg'
|
---|
29 | defaultSummarizer: 'nested',
|
---|
30 | watermarks: configWatermarks,
|
---|
31 | coverageMap,
|
---|
32 | })
|
---|
33 |
|
---|
34 | // create an instance of the relevant report class, passing the
|
---|
35 | // report name e.g. json/html/html-spa/text
|
---|
36 | const report = reports.create('json', {
|
---|
37 | skipEmpty: configSkipEmpty,
|
---|
38 | skipFull: configSkipFull
|
---|
39 | })
|
---|
40 |
|
---|
41 | // call execute to synchronously create and write the report to disk
|
---|
42 | report.execute(context)
|
---|
43 | ```
|
---|
Note:
See
TracBrowser
for help on using the repository browser.