Skip to content

Ignoring code ​

To ignore codes, use the special comment which starts with v8 ignore :

  • Ignoring all until stop
js
/* v8 ignore start */
function uncovered() {
}
/* v8 ignore stop */
  • Ignoring the next line or next N lines
js
/* v8 ignore next */
const os = platform === 'win32' ? 'Windows' : 'Other';

const os = platform === 'win32' ? 'Windows' /* v8 ignore next */ : 'Other';

// v8 ignore next 3
if (platform === 'linux') {
    console.log('hello linux');
}
js
/* c8 ignore start */
function uncovered() {
}
/* c8 ignore stop */

/* node:coverage disable */
function uncovered() {
}
/* node:coverage enable */
  • To disable comment-based ignoring entirely, set v8Ignore: false.