# istanbul ignore next vs c8 ignore next: every hint, measured > istanbul ignore next skips a function in nyc; c8 ignore next skips one line in c8. Which hints each tool honors: next, if, else, file, start and stop. Web page: https://supercov.com/blog/istanbul-ignore-c8-ignore · Published 2026-11-22 All Supercov pages for agents: https://supercov.com/llms.txt · Full text: https://supercov.com/llms-full.txt Every ignore hint tried alone in nyc 18 and c8 12: what it skips, and which ones do nothing. `/* istanbul ignore next */` skips the next function or statement, but only in tools that instrument with Istanbul: nyc, Jest's default provider, Vitest's Istanbul provider. c8 and other V8-based tools read `/* c8 ignore next */`, and there "next" means the next line. ## Which hints each tool honors | Hint | nyc 18 | c8 12 | | --- | --- | --- | | `/* istanbul ignore next */` | The whole next function | Nothing | | `/* istanbul ignore if */`, `else` | That path of the `if` | Nothing | | `/* istanbul ignore file */` | The whole file | Nothing | | `/* istanbul ignore start */` … `stop` | Nothing | Nothing | | `/* c8 ignore next */` | Nothing | One line | | `/* c8 ignore next 4 */` | Nothing | Four lines | | `/* c8 ignore start */` … `stop` | Nothing | Every line between | | `/* c8 ignore else */`, `file` | Nothing | Nothing | | `/* v8 ignore next 4 */` | Nothing | Four lines | ![A grid of eight hints against two tools. nyc honors istanbul ignore next, if and else, and file. c8 honors c8 ignore next, next 4 and start and stop. Neither honors istanbul ignore start and stop, or c8 ignore else and file.](https://supercov.com/assets/istanbul-ignore-c8-ignore-grid-1360.5a3faae62c.webp) *Which tool honors which hint, measured one hint at a time with nyc 18.0.0 and c8 12.0.0.* We measured each hint alone on the same file with nyc 18.0.0, c8 12.0.0, mocha 12.0.3 and Node.js 24. The file has a `sign` function whose `else` no test reaches, and a three-line `debugDump` function no test calls. ## Ignore a function ```js /* istanbul ignore next */ function debugDump(value) { const text = JSON.stringify(value); return text; } ``` In nyc this removed the function: 1 of 1 functions and 3 of 4 lines, where the file had 1 of 2 functions and 3 of 6 lines. In c8 write the line count, or fence the block: ```js /* c8 ignore start */ function debugDump(value) { const text = JSON.stringify(value); return text; } /* c8 ignore stop */ ``` Both `/* c8 ignore next 4 */` and `start` / `stop` took c8 from 10 of 16 lines to 14 of 16. A bare `/* c8 ignore next */` ignored only the `function` line: the body stayed uncovered at 11 of 16. ![Two code panels. With c8 ignore next, only the comment and the function line are ignored and the body stays uncovered: 11 of 16 lines. With c8 ignore next 4, the whole function is ignored: 14 of 16 lines.](https://supercov.com/assets/istanbul-ignore-c8-ignore-flow-1360.54a73a5279.webp) *In c8, next counts lines. In nyc, istanbul ignore next skips the whole function.* ## Ignore an else branch ```js /* istanbul ignore else */ if (x > 0) { return 'positive'; } else { return 'other'; } ``` nyc then reported 1 of 1 branches. `ignore if` is the opposite: it hides the path that runs when the condition is true. On this file, where tests only reach that path, it left 0 of 1 branches. c8 has no `else` hint; `/* c8 ignore else */` changed nothing. Fence the `else` instead: ```js if (x > 0) { return 'positive'; /* c8 ignore start */ } else { return 'other'; } /* c8 ignore stop */ ``` c8 then reported 3 of 3 branches and every line covered, from 2 of 3 branches. ## Why your ignore comment isn't working | What we tried | What happened | | --- | --- | | `istanbul ignore` with c8 | Ignored: c8 reads only `c8` and `v8` hints | | `c8 ignore` with nyc | Ignored | | `c8 ignore next` above a function | Only the first line ignored | | `istanbul ignore start` / `stop` | Not an Istanbul hint; nothing ignored | | `c8 ignore file` or `c8 ignore else` | Not c8 hints; nothing ignored | In TypeScript, a build step can strip comments before coverage sees them. Vitest 5.1 kept them; see [Vitest coverage exclude](https://supercov.com/blog/vitest-coverage-exclude.md). For Jest's two providers, see [Jest coverage exclude](https://supercov.com/blog/jest-coverage-exclude.md). ## What Supercov adds ```sh npx supercov -- npx mocha test npx supercov runs latest gaps ``` Supercov records which test covered each line, with branches and MC/DC. It does not read ignore comments: the `debugDump` function above stayed in its report as not called. To leave a file out, name your source directories instead. See [c8 vs nyc](https://supercov.com/compare/c8-vs-nyc.md) for the two tools side by side.