Files
reverse-engineering-anything/tests/boundary/javascript/asyncChunkCapacity.test.ts
T
morluto 83ed1cbd2a test: let the suite own default test deadlines
178 Vitest cases set an explicit 30 s deadline, the old suite default.
An explicit per-test value overrides the suite setting, so these cases
kept 30 s under coverage (suite: 60 s) and on hosted CI (60 s since
#10417); asyncChunkCapacity.test.ts then timed out at 30 s on main.

Remove only explicit test or describe deadlines equal to 30 s, selected
by syntax tree. Hook deadlines, subprocess timeouts, setTimeout delays
and data values are unchanged. Local runs keep 30 s.
2026-11-13 16:26:35 -05:00

42 lines
1.7 KiB
TypeScript

import { createHash } from "node:crypto";
import { expect, it } from "vitest";
import { javascriptAsyncChunkCapacity } from "../../fixtures/javascriptAsyncChunkCapacity.js";
import { analyzeJavaScriptStaticSource } from "../../fixtures/javascriptStaticAnalysis.js";
it("retains a wide factory's async keys before normalizing the registration", () => {
// The forked boundary project preserves the default main-thread stack.
const count = 130_000;
const { source, factory } = javascriptAsyncChunkCapacity(count);
const result = analyzeJavaScriptStaticSource(source);
expect(result.parse_status).toBe("partial");
expect(result.analysis_coverage?.syntax).toEqual({
status: "complete",
error_count: 0,
});
expect(result.bundler_registrations).toHaveLength(1);
const registration = result.bundler_registrations[0];
if (registration === undefined) throw new Error("Missing registration");
const keys = new Set(registration.async_chunk_keys);
expect(registration.async_chunk_keys).toHaveLength(count + 1);
expect(keys.size).toBe(count + 1);
expect(
Array.from({ length: count }, (_, index) => String(index)).every((key) =>
keys.has(key),
),
).toBe(true);
expect(registration.async_chunk_keys[0]).toBe("0");
expect(registration.async_chunk_keys.at(-1)).toBe("later");
expect(registration.unknown_async_chunk_keys).toBe(1);
expect(registration.modules).toHaveLength(2);
const start = source.indexOf(factory);
expect(registration.modules[0]).toMatchObject({
module_key: "1",
factory_require_name: "r",
source_sha256: createHash("sha256").update(factory).digest("hex"),
location: {
start: { line: 1, column: start },
end: { line: 1, column: start + factory.length },
},
});
});