test: prune redundant and implementation-coupled coverage

This commit is contained in:
morluto committed 2026-11-17 18:48:24 -05:00
1 parent 14b15ba8a5
commit 48e27e19b7
191 files changed
+2757 -5418

No files matched your search

@@ -154,6 +154,7 @@ it("retains candidate endpoint interpretation across the worker boundary", () =>
const facts = analyzeJavaScriptStaticSource(`
client.get("settingKey");
fetch("/api");
http.request("POST", target);
`);
expect(facts.endpoints).toEqual([
expect.objectContaining({
@@ -161,6 +162,11 @@ it("retains candidate endpoint interpretation across the worker boundary", () =>
interpretation: "candidate",
}),
expect.objectContaining({ value: "/api" }),
expect.objectContaining({
kind: "network",
value: "POST",
interpretation: "candidate",
}),
]);
expect(facts.endpoints[1]).not.toHaveProperty("interpretation");
const serialized = JSON.parse(JSON.stringify(facts)) as unknown;
@@ -176,54 +182,33 @@ it("retains candidate endpoint interpretation across the worker boundary", () =>
).toBe(false);
});
it.each(["babel-ast-v1", "babel-ast-v2"])(
"versions fingerprints through the worker schema and rejects %s",
(oldAlgorithm) => {
const facts =
analyzeJavaScriptStaticSource(`globalThis.webpackChunkApp.push([[1], {
it("admits the current fingerprint version and refuses an incompatible one", () => {
const facts =
analyzeJavaScriptStaticSource(`globalThis.webpackChunkApp.push([[1], {
17(module, exports) { const key = selectKey(); exports.read = value[key]; }
}]);`);
expect(facts.bundler_registrations[0]?.modules[0]).toMatchObject({
structural_fingerprint_algorithm: "babel-ast-v3",
structural_fingerprint_sha256: expect.stringMatching(/^[a-f0-9]{64}$/u),
});
expect(
javaScriptWorkerStaticAnalysisSchema.safeParse(
JSON.parse(JSON.stringify(facts)) as unknown,
).success,
).toBe(true);
const old = {
...facts,
bundler_registrations: facts.bundler_registrations.map(
(registration) => ({
...registration,
modules: registration.modules.map((module) => ({
...module,
structural_fingerprint_algorithm: oldAlgorithm,
})),
}),
),
};
expect(javaScriptWorkerStaticAnalysisSchema.safeParse(old).success).toBe(
false,
);
},
);
it("accepts candidate endpoint interpretations from static analysis", () => {
const facts = analyzeJavaScriptStaticSource(`http.request("POST", target);`);
expect(facts.endpoints).toContainEqual(
expect.objectContaining({
kind: "network",
value: "POST",
interpretation: "candidate",
}),
);
expect(facts.bundler_registrations[0]?.modules[0]).toMatchObject({
structural_fingerprint_algorithm: "babel-ast-v3",
structural_fingerprint_sha256: expect.stringMatching(/^[a-f0-9]{64}$/u),
});
expect(
javaScriptWorkerStaticAnalysisSchema.safeParse(
JSON.parse(JSON.stringify(facts)) as unknown,
).success,
).toBe(true);
const old = {
...facts,
bundler_registrations: facts.bundler_registrations.map((registration) => ({
...registration,
modules: registration.modules.map((module) => ({
...module,
structural_fingerprint_algorithm: "babel-ast-v2",
})),
})),
};
expect(javaScriptWorkerStaticAnalysisSchema.safeParse(old).success).toBe(
false,
);
});
it("preserves partial request targets through the strict worker schema", () => {
+7 -10
View File
@@ -29,7 +29,6 @@ import {
runWakaruCommand,
type WakaruLauncher,
} from "./WakaruCommand.js";
import { prlimitArgumentVector } from "../../process/LinuxResourceLimits.js";
import { RECOVERY_LIMITS } from "./WakaruRelease.js";
it("names the Wakaru configuration requirement when it is not configured", async () => {
@@ -424,7 +423,7 @@ it("enforces the shared deadline while exited output streams remain open", async
}
});
it("pins both Wakaru ceilings through the shared prlimit vector", async () => {
it("launches Wakaru with fixed memory, file and CPU ceilings", async () => {
let observed: readonly string[] | undefined;
const producer = createProducer();
const command = "/selected/wakaru";
@@ -459,14 +458,12 @@ it("pins both Wakaru ceilings through the shared prlimit vector", async () => {
}),
).resolves.toMatchObject({ exit_code: 0 });
expect(observed).toEqual([
...prlimitArgumentVector(
{
address_space_bytes: RECOVERY_LIMITS.addressSpaceBytes,
file_bytes: RECOVERY_LIMITS.outputBytes,
cpu_seconds: RECOVERY_LIMITS.cpuSeconds,
},
command,
),
"--as=1073741824:1073741824",
"--fsize=134217728:134217728",
"--cpu=120:120",
"--core=0:0",
"--",
command,
"--version",
]);
});