Add `ignore start` and `ignore stop` coverage ignore hints
Clear and concise description of the problem
In Vitest v3 it was possible to use ignore start and ignore stop code coverage ignore hints on V8 coverage. This was possible due to usage of v8-to-istanbul. However v8-to-istanbul had really limited support for ignore hints as it doesn't operate on AST level - it did not support ignore if, ignore else or ignore next. Also v8-to-istanbul reports inaccurate coverage results which was the main reason to replace it.
Users on Vitest v3 got used to ignore start and ignore stop and have been asking its support in:
- https://github.com/vitest-dev/vitest/discussions/8801
- https://github.com/vitest-dev/vitest/discussions/3183
One major difference in v8-to-istanbul's ignore hint support is that it "parsed" (regex match against text file) the original source file instead of the transpiled runtime code. This made it possible to use ignore hints even when the compiler (99% of times Vue) removed comments, or placed the generated code on different line.
Note that istanbul-lib-instrument has never supported ignore start/stop in its 13 years of existence. This is just a work-around v8-to-istanbul had to come up with due to its lack of AST analysis.
Suggested solution
Add support for ignore start and ignore stop to upstream packages. These ignore hints should be parsed from the original source text file, not from the transpiled runtime code.
Alternative
Have the same conversation over and over again explaining the difference between these coverage tools.
Additional context
Support for V8 coverage:
- https://github.com/AriPerkkio/ast-v8-to-istanbul/pull/109
Support for Istanbul coverage:
- https://github.com/istanbuljs/istanbuljs/pull/835
Validations
- [x] Follow our Code of Conduct
- [x] Read the Contributing Guidelines.
- [x] Read the docs.
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.