|
1 | 1 | import fs, { existsSync } from "node:fs"; |
| 2 | +import os from "node:os"; |
2 | 3 | import path from "node:path"; |
3 | 4 |
|
4 | 5 | import * as NodeServices from "@effect/platform-node/NodeServices"; |
@@ -1279,30 +1280,27 @@ it.layer(TestLayer)("git integration", (it) => { |
1279 | 1280 |
|
1280 | 1281 | it.effect("returns an empty status for a missing workspace path", () => |
1281 | 1282 | 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-")); |
1283 | 1286 | yield* initRepoWithCommit(tmp); |
1284 | 1287 | const core = yield* GitCore; |
1285 | 1288 |
|
1286 | 1289 | expect(existsSync(tmp)).toBe(true); |
1287 | | - yield* Effect.sync(() => fs.rmSync(tmp, { recursive: true, force: true })); |
| 1290 | + fs.rmSync(tmp, { recursive: true, force: true }); |
1288 | 1291 |
|
1289 | 1292 | 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 | + }); |
1306 | 1304 | }), |
1307 | 1305 | ); |
1308 | 1306 |
|
|
0 commit comments