diff --git a/packages/core/src/compiler/htmlBundler.test.ts b/packages/core/src/compiler/htmlBundler.test.ts
index c70f49037..665ff9811 100644
--- a/packages/core/src/compiler/htmlBundler.test.ts
+++ b/packages/core/src/compiler/htmlBundler.test.ts
@@ -105,12 +105,12 @@ describe("bundleToSingleHtml", () => {
const bundled = await bundleToSingleHtml(dir);
// Run every inline script body through esbuild; if the line comment ate
// the separator, parse would fail with an unexpected-token error somewhere
- // around the chunk boundary.
+ // around the chunk boundary. Use a real HTML parser (CodeQL flags regex-
+ // based script extraction as bad-tag-filter).
const { transformSync } = await import("esbuild");
- const re = /