Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoring branches requires comments unnaturally positioned outside {} #246

Open
andersk opened this issue Apr 11, 2024 · 0 comments
Open

Comments

@andersk
Copy link

andersk commented Apr 11, 2024

In order to mark an if or else branch as ignored, the /* v8 ignore start *//* v8 ignore stop */ comments currently need to be positioned outside the {}, which is awkward (especially when formatting with Prettier):

if (false /* v8 ignore start */) {
  console.log("uncovered");
} /* v8 ignore stop */ else {
  console.log("covered");
}

if (true) {
  console.log("covered");
} /* v8 ignore start */ else {
  console.log("uncovered");
} /* v8 ignore stop */

It would be nicer if the else, {, and } tokens were automatically considered part of the ignored range if the statements inside are ignored, and the comments could be placed more naturally:

if (false) {
  /* v8 ignore start */
  console.log("uncovered");
  /* v8 ignore stop */
} else {
  console.log("covered");
}

if (true) {
  console.log("covered");
} else {
  /* v8 ignore start */
  console.log("uncovered");
  /* v8 ignore stop */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant