The test nginx is now the production shape of DESIGN 11.1 and the browser gate's real path (#66, spec #63 decision 6): TLS-only listener with http2 on, a self-signed certificate generated per run (tools/tlsdev.mjs, added to the process's default CA list so verification stays on), the client dist at / with SPA fallback, index no-cache and a year-immutable /assets/ cache, and the tile gate's internal /_tiles/ still unreachable. Existing tile/doors/oneway/wallbehaviour harnesses point their server's public origin at the https vhost, so they prove the same listener the browser uses. tools/vhost.test.mjs is the independent node:http2 client (cert SANs, ALPN h2, cache headers, SPA fallback, direct /_tiles/ 404); e2e/h2.test.mjs drives devbox chromium via playwright-core and asserts the page reports h2 (`devbox run e2e`, npm deps outside tools/). Root devbox gains chromium + openssl. Harness builds use a worktree-local nimcache so parallel worktrees stop corrupting each other's objects. Refs #66
25 lines
1.1 KiB
JavaScript
25 lines
1.1 KiB
JavaScript
// A throwaway client build for the vhost tests (#66). The real Vite build lands in T4; until then the
|
|
// test nginx's `/` needs *some* `dist` to serve, with the shape DESIGN 11.1 pins: an index.html that
|
|
// names a content-hashed asset under /assets/. Nothing here is committed: the fixture is written into
|
|
// the run's state dir, and no version of it pretends to be the client.
|
|
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
export const ASSET_HASH = 'a1b2c3d4e5f6'
|
|
|
|
export function writeClientDist(dir, { hash = ASSET_HASH } = {}) {
|
|
const assetPath = `/assets/app-${hash}.js`
|
|
fs.mkdirSync(path.join(dir, 'assets'), { recursive: true })
|
|
const index = `<!doctype html>
|
|
<html lang="en">
|
|
<head><meta charset="utf-8"><title>fff-vtt client fixture</title>
|
|
<script type="module" src="${assetPath}"></script></head>
|
|
<body><p id="fixture">client dist fixture</p></body>
|
|
</html>
|
|
`
|
|
const asset = `// content-hashed fixture asset (#66)\ndocument.documentElement.dataset.fixture = 'loaded'\n`
|
|
fs.writeFileSync(path.join(dir, 'index.html'), index)
|
|
fs.writeFileSync(path.join(dir, assetPath.slice(1)), asset)
|
|
return { dir, indexHtml: index, assetPath }
|
|
}
|