@@ -44,20 +44,47 @@ To check thresholds on a per-file basis run:
4444c8 check-coverage --lines 95 --per-file
4545```
4646
47+ ## Ignoring Uncovered Lines, Functions, and Blocks
48+
49+ Sometimes you might find yourself wanting to ignore uncovered portions of your
50+ codebase. For example, perhaps you run your tests on Linux, but
51+ there's some logic that only executes on Windows.
52+
53+ To ignore lines, blocks, and functions, use the special comment:
54+
55+ ` /* c8 ignore next */ ` .
56+
57+ ### Ignoring the next element
58+
59+ ``` js
60+ const myVariable = 99
61+ /* c8 ignore next */
62+ if (process .platform === ' win32' ) console .info (' hello world' )
63+ ```
64+
65+ ### Ignoring the next N elements
66+
67+ ``` js
68+ const myVariable = 99
69+ /* c8 ignore next 3 */
70+ if (process .platform === ' win32' ) {
71+ console .info (' hello world' )
72+ }
73+ ```
74+
75+ ### Ignoring a block on the current line
76+
77+ ``` js
78+ const myVariable = 99
79+ const os = process .platform === ' darwin' ? ' OSXy' /* c8 ignore next */ : ' Windowsy'
80+ ```
81+
4782## Supported Node.js Versions
4883
4984c8 uses
5085[ bleeding edge Node.js features] ( https://github.com/nodejs/node/pull/22527 ) ,
5186make sure you're running Node.js ` >= 10.12.0 ` .
5287
53- ## Goals of the Project
54-
55- A fully functional code coverage solution using only V8's native coverage
56- features and minimal user-land modules, so that we fit these constraints:
57-
58- * No parsing of JavaScript code.
59- * No mucking with Node.js' runtime environment.
60-
6188## Contributing to ` c8 `
6289
6390See the [ contributing guide here] ( ./CONTRIBUTING.md ) .
0 commit comments