fix(ui): stub Node built-ins for fixture bundle
CI / check (push) Failing after 20s
CI / tests-unit (push) Skipped
CI / tests-integration (push) Skipped
CI / tests-ui (push) Skipped
CI / tests-imaging-browsers (push) Skipped
CI / tests-quality (push) Skipped
CI / preflight (push) Skipped
CI / deploy (push) Skipped
CI / check (push) Failing after 20s
CI / tests-unit (push) Skipped
CI / tests-integration (push) Skipped
CI / tests-ui (push) Skipped
CI / tests-imaging-browsers (push) Skipped
CI / tests-quality (push) Skipped
CI / preflight (push) Skipped
CI / deploy (push) Skipped
Replace platform: 'node' (incompatible with iife browser bundle) with explicit aliases for node:async_hooks, node:crypto, node:fs/promises, node:path pointing at e2e/ui/node-stubs.mjs. Provides shape-compatible exports so esbuild can bundle the UI fixture without failing on Node built-ins. Increase webServer timeout to 120s for reliable startup.
This commit is contained in:
1 parent
728999b2de
commit
e870beb71c
3 files changed
+45
-3
No files matched your search
@@ -23,6 +23,7 @@ const actions = new Set([
|
||||
"@/actions/article-recovery",
|
||||
"@/actions/admin-media",
|
||||
]);
|
||||
const nodeStubs = path.join(root, "e2e/ui/node-stubs.mjs");
|
||||
const bundle = await build({
|
||||
entryPoints: [path.join(fixtures, "entry.tsx")],
|
||||
bundle: true,
|
||||
@@ -30,8 +31,13 @@ const bundle = await build({
|
||||
outdir: path.join(root, "test-results/ui-fixture"),
|
||||
format: "iife",
|
||||
jsx: "automatic",
|
||||
platform: "node",
|
||||
alias: { "@": path.join(root, "src") },
|
||||
alias: {
|
||||
"@": path.join(root, "src"),
|
||||
"node:async_hooks": nodeStubs,
|
||||
"node:crypto": nodeStubs,
|
||||
"node:fs/promises": nodeStubs,
|
||||
"node:path": nodeStubs,
|
||||
},
|
||||
define: { "process.env.NODE_ENV": '"production"' },
|
||||
plugins: [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
// Stubs for Node.js built-ins used by server-only modules that leak into the
|
||||
// UI fixture bundle. These keep esbuild from failing on `node:*` imports
|
||||
// while providing shape-compatible exports so the bundle stays loadable.
|
||||
|
||||
export class AsyncLocalStorage<T = unknown> {
|
||||
enterWith(): void {}
|
||||
exit(): void {}
|
||||
getStore(): T | undefined {
|
||||
return undefined;
|
||||
}
|
||||
run<U>(store: T, work: () => U): U {
|
||||
return work();
|
||||
}
|
||||
}
|
||||
|
||||
export function createHash(): { update(): { digest(): string } } {
|
||||
return {
|
||||
update: () => ({
|
||||
digest: () => "",
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
export function randomUUID(): string {
|
||||
return "00000000-0000-0000-0000-000000000000";
|
||||
}
|
||||
|
||||
export async function readFile(): Promise<Buffer> {
|
||||
return Buffer.alloc(0);
|
||||
}
|
||||
|
||||
export const path = {
|
||||
join: (...parts: string[]): string => parts.join("/"),
|
||||
resolve: (...parts: string[]): string => parts.join("/"),
|
||||
sep: "/",
|
||||
};
|
||||
Reference in new issue
Block a user