提交新版界面生产构建 web/dist;/next/ 的 HTTP 测试改为必跑

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
黄健铭andClaude Opus 5.5 committed 2026-12-04 19:15:24 -08:00
1 parent 698a0a84e0
commit 03155ca33a
7 files changed
+304 -6

No files matched your search

+4 -6
View File
@@ -7,7 +7,7 @@ const test = require('node:test'),
os = require('node:os'),
path = require('node:path');
const { createApp } = require('../server');
const { serveWebNext, webNextEnabled, isNextPath, DIST_DIR } = require('../server/middleware/web-next');
const { serveWebNext, webNextEnabled, isNextPath } = require('../server/middleware/web-next');
function fakeDist(t) {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'web-next-dist-'));
@@ -138,9 +138,7 @@ async function startApp(t, mode, extra = {}) {
return app.server.address().port;
}
const hasDist = fs.existsSync(path.join(DIST_DIR, 'index.html'));
test('HTTP:试用模式提供 /next/ 页面与资源,带安全响应头;旧界面与未知地址行为不变', { skip: !hasDist }, async t => {
test('HTTP:试用模式提供 /next/ 页面与资源,带安全响应头;旧界面与未知地址行为不变', async t => {
const port = await startApp(t, 'trial');
const index = await request(port, '/next/');
assert.equal(index.status, 200);
@@ -171,12 +169,12 @@ test('HTTP:试用模式提供 /next/ 页面与资源,带安全响应头;
assert.equal(post.status, 404);
});
test('HTTP:演示模式同样开启 /next/', { skip: !hasDist }, async t => {
test('HTTP:演示模式同样开启 /next/', async t => {
const port = await startApp(t, 'demo');
assert.equal((await request(port, '/next/')).status, 200);
});
test('HTTP:云端模式默认不提供 /next/(按未知地址 404),设置 WEB_NEXT=1 后提供', { skip: !hasDist }, async t => {
test('HTTP:云端模式默认不提供 /next/(按未知地址 404),设置 WEB_NEXT=1 后提供', async t => {
const names = ['PUBLIC_URL', 'DATA_DIR', 'OWNER_INITIAL_PASSWORD', 'ASSISTANT_INITIAL_PASSWORD', 'WEB_NEXT'];
const saved = Object.fromEntries(names.map(name => [name, process.env[name]]));
t.after(() => {