Skip to content

Commit bfe2af6

Browse files
BunsDevclaude
andcommitted
fix(test): use non-scoped temp dir in missing-workspace test
The test intentionally deletes its temp directory, which conflicts with Effect's scoped cleanup. Switch to a plain mkdtempSync so scope finalization does not ENOENT on the already-removed path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0c82566 commit bfe2af6

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

apps/server/src/git/Layers/GitCore.test.ts

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs, { existsSync } from "node:fs";
2+
import os from "node:os";
23
import path from "node:path";
34

45
import * as NodeServices from "@effect/platform-node/NodeServices";
@@ -1279,30 +1280,27 @@ it.layer(TestLayer)("git integration", (it) => {
12791280

12801281
it.effect("returns an empty status for a missing workspace path", () =>
12811282
Effect.gen(function* () {
1282-
const tmp = yield* makeTmpDir();
1283+
// Use a non-scoped temp dir since this test intentionally deletes it;
1284+
// a scoped directory would cause ENOENT during scope cleanup.
1285+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "git-test-"));
12831286
yield* initRepoWithCommit(tmp);
12841287
const core = yield* GitCore;
12851288

12861289
expect(existsSync(tmp)).toBe(true);
1287-
yield* Effect.sync(() => fs.rmSync(tmp, { recursive: true, force: true }));
1290+
fs.rmSync(tmp, { recursive: true, force: true });
12881291

12891292
const details = yield* core.statusDetails(tmp);
1290-
expect(details).toEqual(
1291-
expect.objectContaining({
1292-
branch: null,
1293-
hasWorkingTreeChanges: false,
1294-
hasConflicts: false,
1295-
conflictedFiles: [],
1296-
hasUpstream: false,
1297-
aheadCount: 0,
1298-
behindCount: 0,
1299-
upstreamRef: null,
1300-
pr: null,
1301-
}),
1302-
);
1303-
expect(details.workingTree.files).toEqual([]);
1304-
expect(details.workingTree.insertions).toBe(0);
1305-
expect(details.workingTree.deletions).toBe(0);
1293+
expect(details).toEqual({
1294+
branch: null,
1295+
hasWorkingTreeChanges: false,
1296+
hasConflicts: false,
1297+
conflictedFiles: [],
1298+
hasUpstream: false,
1299+
aheadCount: 0,
1300+
behindCount: 0,
1301+
upstreamRef: null,
1302+
workingTree: { files: [], insertions: 0, deletions: 0 },
1303+
});
13061304
}),
13071305
);
13081306

0 commit comments

Comments
 (0)