source: frontend/node_modules/v8-to-istanbul/README.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.3 KB
Line 
1# v8-to-istanbul
2
3[![Build Status](https://travis-ci.org/istanbuljs/v8-to-istanbul.svg?branch=master)](https://travis-ci.org/istanbuljs/v8-to-istanbul)
4[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
5![nycrc config on GitHub](https://img.shields.io/nycrc/istanbuljs/v8-to-istanbul)
6
7converts from v8 coverage format to [istanbul's coverage format](https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md).
8
9## Usage
10
11```js
12const v8toIstanbul = require('v8-to-istanbul')
13// the path to the original source-file is required, as its contents are
14// used during the conversion algorithm.
15const converter = v8toIstanbul('./path-to-instrumented-file.js')
16await converter.load() // this is required due to the async source-map dependency.
17// provide an array of coverage information in v8 format.
18converter.applyCoverage([
19 {
20 "functionName": "",
21 "ranges": [
22 {
23 "startOffset": 0,
24 "endOffset": 520,
25 "count": 1
26 }
27 ],
28 "isBlockCoverage": true
29 },
30 // ...
31])
32// output coverage information in a form that can
33// be consumed by Istanbul.
34console.info(JSON.stringify(converter.toIstanbul()))
35
36// cleanup resources allocated in "load" (i.e. by the source-map dependency),
37// the converter may not be used anymore afterwards
38converter.destroy()
39```
40
41## Ignoring Uncovered Lines
42
43Sometimes you might find yourself wanting to ignore uncovered lines
44in your application (for example, perhaps you run your tests in Linux, but
45there's code that only executes on Windows).
46
47To ignore lines, use the special comment `/* c8 ignore next */`.
48
49### ignoring the next line
50
51```js
52const myVariable = 99
53/* c8 ignore next */
54if (process.platform === 'win32') console.info('hello world')
55```
56
57### ignoring the next N lines
58
59```js
60const myVariable = 99
61/* c8 ignore next 3 */
62if (process.platform === 'win32') {
63 console.info('hello world')
64}
65```
66
67### ignoring all lines until told
68
69```js
70/* c8 ignore start */
71function dontMindMe() {
72 // ...
73}
74/* c8 ignore stop */
75```
76
77### ignoring the same line as the comment
78
79```js
80const myVariable = 99
81const os = process.platform === 'darwin' ? 'OSXy' /* c8 ignore next */ : 'Windowsy'
82```
83
84## Testing
85
86To execute tests, simply run:
87
88```bash
89npm test
90```
Note: See TracBrowser for help on using the repository browser.