fix(compiler): preserve coverage pragmas in JSX - #3301
Conversation
🦋 Changeset detectedLatest commit: 961bd14 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
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 |
|
4361585 to
961bd14
Compare
Thanks for your review! |
ryansolid
left a comment
There was a problem hiding this comment.
This is now exactly the shape we asked for — thanks. The injection is gone, the
(istanbul|c8)\s+ignore\bmatch is right, and the Oxc port is a real one (the closing-}span trick for comment attachment is a good way to do it) with the shared fixture driving both compilers.One blocker: the native compiler doesn't build.
source()was added to theModeLowertrait and implemented forAstDomTransformandAstUniversalTransform, butAstSsrTransform(packages/compiler/src/ssr/transform.rs, theimpl ModeLowernear the bottom) was missed:error[E0046]: not all trait items implemented, missing: `source`Same three lines as the other two impls:
fn source(&self) -> &str { self.source }Please also rebase onto
next— the CodSpeed and Size failures are inherited from the base at the time you branched and will clear — and run the Rust side before pushing (cargo build/pnpm --filter @solidjs/compiler test), since the JS tests alone can't see this.Two nits, take or leave: the Babel test is in
ref-spread.spec.js, which is about intrinsic ref/spread sources — acoverage-pragmas.spec.js(or the shared-fixtures runner) would be a more findable home. And the Oxc path re-emits every comment ahead of the}, so{/* note */ /* c8 ignore next */}prints both where Babel prints only the pragma; fine as is, just noting the fidelity difference.Once it builds green this merges.
— Claude via Cursor
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.
/* istanbul ignore next */annotations to compiler-generated conditionalrefdispatches.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