build(trial): preserve deployed source for knowledge refresh

This commit is contained in:
鲨鱼辣椒 committed 2026-10-13 14:29:33 +08:00
1 parent 8e0e52f30e
commit 2d4e44f4a0
42 files changed
+2321 -283

No files matched your search

+4 -4
View File
@@ -1,5 +1,5 @@
import { test, expect, type Page } from '@playwright/test';
import { build } from 'vite';
import { build, normalizePath } from 'vite';
import { createServer, type Server } from 'node:http';
import { mkdtemp, readFile, realpath, rm, symlink, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
@@ -23,7 +23,7 @@ test.beforeAll(async () => {
const html = join(fixtureDir, 'index.html');
const output = join(fixtureDir, 'dist');
await writeFile(html, '<!doctype html><html><head><meta charset="utf-8"></head><body><div id="root"></div><script type="module" src="/__cloud-agent-knowledge-harness.tsx"></script></body></html>');
const entry = resolve('tests/e2e/__cloud-agent-knowledge-harness.tsx');
const entry = normalizePath(resolve('tests/e2e/__cloud-agent-knowledge-harness.tsx'));
// Build the virtual entry once. A static fixture needs no Vite dev server,
// background dependency discovery, file watcher, or HMR connection.
await build({
@@ -38,8 +38,8 @@ test.beforeAll(async () => {
if (id === entry) return `
import { createRoot } from 'react-dom/client';
import { createMemoryRouter, RouterProvider } from 'react-router-dom';
import CloudAgents from ${JSON.stringify(resolve('src/pages/CloudAgents/index.tsx'))};
import ${JSON.stringify(resolve('src/styles/globals.css'))};
import CloudAgents from ${JSON.stringify(normalizePath(resolve('src/pages/CloudAgents/index.tsx')))};
import ${JSON.stringify(normalizePath(resolve('src/styles/globals.css')))};
const router = createMemoryRouter([{ path: '/cloud-agents', element: <CloudAgents /> }], { initialEntries: ['/cloud-agents?view=mine'] });
createRoot(document.getElementById('root')).render(<div className="h-screen min-w-0"><RouterProvider router={router} /></div>);
`;