Skip to content

fix(compiler): preserve coverage pragmas in JSX - #3301

Open
nickshiro wants to merge 1 commit into
solidjs:nextfrom
nickshiro:fix/compiler-istanbul-comments
Open

fix(compiler): preserve coverage pragmas in JSX#3301
nickshiro wants to merge 1 commit into
solidjs:nextfrom
nickshiro:fix/compiler-istanbul-comments

Conversation

@nickshiro

Copy link
Copy Markdown

Summary

ref #2138

Preserve JSX Istanbul ignore comments when compiling component children, and annotate compiler-generated ref dispatch branches so they do not count toward coverage.

  • Add /* istanbul ignore next */ annotations to compiler-generated conditional ref dispatches.
  • Add regression coverage.

How did you test this change?

  • pnpm --filter @solidjs/babel-plugin exec vitest run
    28 test files passed, 259 tests passed

  • pnpm --filter @solidjs/babel-plugin typecheck

@changeset-bot

changeset-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 961bd14

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
test-integration Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal Patch
@solidjs/web Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codspeed-hq

codspeed-hq Bot commented Sep 7, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 142 untouched benchmarks


Comparing nickshiro:fix/compiler-istanbul-comments (4361585) with next (b6a90f9)

Open in CodSpeed

@ryansolid

Copy link
Copy Markdown
Member

Thanks for taking this on — half of it is exactly what we want, and the diff splits cleanly along that line.

Keep: preserving the user's own pragma. A {/* istanbul ignore next */} the author wrote in JSX should survive onto the get children() getter the compiler emits. That is comment fidelity for a deliberate annotation, and it's the right layer for it. Two asks on this half:

  • Match c8 ignore alongside istanbul ignore (/^\s*(istanbul|c8)\s+ignore\b/). v8-based coverage is what most Vitest users run now, and it's the same regex.
  • Oxc parity. The Babel plugin and packages/compiler share codegen expectations; the same carry-through needs to land in the native compiler with the shared fixture before this can merge.

Drop: injecting /* istanbul ignore next */ on the generated ref dispatch. This is the part that touches dom/element.ts, universal/element.ts, and rewrites fourteen fixture outputs, and we don't want it — not for size, on principle:

  • The compiler would be emitting a specific tool's pragma into every user's output. That's tool knowledge in the wrong layer, and it doesn't stop at one vendor.
  • Coverage of compiler-generated branches is the coverage tool's problem, and the tools have been solving it: v8 coverage with AST-aware remapping attributes back through the source map to the JSX, where there is no branch. Instrumenting post-compile output with Istanbul is the configuration that produces the phantom branches.
  • Every injected comment is dev-build bytes for everyone and one more thing both compilers must mirror forever.

If real demand shows up later, an explicit opt-in is the ceiling we'd consider, but we'd rather not add it speculatively.

Also: @solidjs/web#test-types is red on this branch. It's probably the base (next moved on Sep 7); a rebase should tell.

Once it's down to the preserve half + c8 + Oxc parity, happy to merge.

Claude via Cursor

@nickshiro
nickshiro force-pushed the fix/compiler-istanbul-comments branch from 4361585 to 961bd14 Compare September 9, 2026 10:08
@nickshiro

nickshiro commented Sep 9, 2026

Copy link
Copy Markdown
Author
  • Removed all automatically injected coverage comments from generated ref dispatches.
  • Preserved only user-authored JSX pragmas, now supporting both istanbul ignore and c8 ignore.
  • Added Oxc parity for DOM, Universal, and SSR.
  • Added a shared fixture consumed by the Babel and native compiler regression tests.

Thanks for your review!

@nickshiro nickshiro changed the title fix(babel): preserve Istanbul ignore comments in generated output fix(compiler): preserve coverage pragmas in JSX Sep 9, 2026
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

Successfully merging this pull request may close these issues.

2 participants