/** * 客户端托管冒烟测试(任务 A1.5)。 * * 验证「构建后由平台服务单端口托管」这条路:GET / 返回客户端页面,静态资源可取, * 同时 /v1 接口不受影响。 */ import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import { test } from 'node:test'; import { fileURLToPath } from 'node:url'; const ROOT = fileURLToPath(new URL('..', import.meta.url)); const isWindows = process.platform === 'win32'; test('平台服务托管客户端产物,且 API 不受影响', async () => { execFileSync('pnpm', ['--filter', '@aps/client-app', 'run', 'build'], { cwd: ROOT, stdio: 'pipe', shell: isWindows }); const { startServer } = await import('../server/dist/index.js'); const server = await startServer({ host: '127.0.0.1', port: 0, version: 'test' }); try { const page = await fetch(`${server.url}/`); assert.equal(page.status, 200, 'GET / 应返回客户端页面'); const html = await page.text(); assert.match(html, /