test(sw): shared Playwright runtime resolver

This commit is contained in:
shkim4 committed 2026-10-20 21:49:46 +09:00
1 parent 94c0a13c74
commit df650c02dd
23 files changed
+120 -55

No files matched your search

@@ -1,14 +1,14 @@
// Browser check of the independent consumer built by ai-template-consumer.mjs.
// Usage: node packages/sw/tests/ai-template-consumer.browser.mjs <consumer-dir> <evidence-dir>
// Serves <consumer-dir>/dist and checks examples A–D (rendering, assets, dropdowns, callbacks, focus, styles).
import { createRequire } from "node:module"
import { createServer } from "node:http"
import { mkdir, readFile, writeFile } from "node:fs/promises"
import path from "node:path"
import { loadPlaywright } from "./playwright-runtime.mjs"
const dist = path.resolve(process.argv[2], "dist")
const out = path.resolve(process.argv[3])
const { chromium } = createRequire(import.meta.url)(process.env.SW_PLAYWRIGHT_PATH ?? "C:/Users/user/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright")
const { chromium } = loadPlaywright()
await mkdir(out, { recursive: true })
const types = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css" }
const server = createServer(async (request, response) => {