Skip to content

codegen: preserve comments between CatchClause's param and body #16076

Description

@AriPerkkio

Code coverage tooling that support ignore next ignore hint need code transforms to preserve comments between catch(param) { in order to be able to ignore catch block's body.

catch (err) /* v8 ignore next */ {
// instructs coverage tooling    ^
// to ignore this BlockStatement ^

Input:

try {
  console.log('test');
}
catch (err) /* v8 ignore next */ {
  console.error(err);
}

Expected output:

try {
  console.log('test');
}
catch (err) /* v8 ignore next */ {
  console.error(err);
}

Actual output:

try {
  console.log('test');
}
catch (err) {
  console.error(err);
}

https://playground.oxc.rs/#eNptU01v2...

Initial coverage ignore hint support added in:

Downstream Vitest issue:

Metadata

Metadata

Assignees

Labels

A-codegenArea - Code Generation

Fields

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions