Files
reverse-engineering-anything/tests/boundary/javascript/asyncChunkCapacity.test.ts
T
46728ca41d test: remove per-test deadlines owned by project policy
Explicit deadlines at or below the project deadline only shortened it:
a literal 30-second value also disabled the coverage scaling, which timed
out wide-capacity regressions on main. Workloads above the built
deadline use the long-running tag. Deadlines derived from an operation
budget remain.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 05:27:07 +08: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 },
},
});
});