fix(test): harden planner artifact cleanup and profile env fallback

This commit is contained in:
Peter Steinberger
2026-03-29 00:19:57 +00:00
parent c3a0304f63
commit 03826b8075
4 changed files with 107 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ import path from "node:path";
import { describe, expect, it } from "vitest";
import {
createExecutionArtifacts,
createTempArtifactWriteStream,
resolvePnpmCommandInvocation,
resolveVitestFsModuleCachePath,
} from "../../scripts/test-planner/executor.mjs";
@@ -348,6 +349,24 @@ describe("test planner", () => {
expect(fs.existsSync(artifactDir)).toBe(false);
});
it("keeps fd-backed artifact streams writable after temp cleanup", async () => {
const artifacts = createExecutionArtifacts({});
const artifactDir = artifacts.ensureTempArtifactDir();
const logPath = path.join(artifactDir, "lane.log");
const stream = createTempArtifactWriteStream(logPath);
stream.write("before cleanup\n");
artifacts.cleanupTempArtifacts();
await expect(
new Promise((resolve, reject) => {
stream.on("error", reject);
stream.end("after cleanup\n", resolve);
}),
).resolves.toBeNull();
expect(fs.existsSync(artifactDir)).toBe(false);
});
it("builds a CI manifest with planner-owned shard counts and matrices", () => {
const manifest = buildCIExecutionManifest(
{