Skip to content

Ignoring branches requires comments unnaturally positioned outside {} #246

@andersk

Description

@andersk

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 */
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions