Skip to content

Commit f7dbb4d

Browse files
chore: generate
1 parent c5849e5 commit f7dbb4d

1 file changed

Lines changed: 43 additions & 10 deletions

File tree

packages/opencode/test/project/project.test.ts

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ function projectLayerWithFailure(failArg: string) {
8585
)
8686
}
8787

88-
const failureIt = (failArg: string) => testEffect(Layer.mergeAll(projectLayerWithFailure(failArg), CrossSpawnSpawner.defaultLayer))
88+
const failureIt = (failArg: string) =>
89+
testEffect(Layer.mergeAll(projectLayerWithFailure(failArg), CrossSpawnSpawner.defaultLayer))
8990

9091
describe("Project.fromDirectory", () => {
9192
it.live("should handle git repository with no commits", () =>
@@ -192,7 +193,14 @@ describe("Project.fromDirectory with worktrees", () => {
192193
const tmp = yield* gitTmpdir()
193194

194195
const worktreePath = path.join(tmp, "..", path.basename(tmp) + "-worktree")
195-
yield* Effect.addFinalizer(() => Effect.promise(() => $`git worktree remove ${worktreePath}`.cwd(tmp).quiet().catch(() => {})))
196+
yield* Effect.addFinalizer(() =>
197+
Effect.promise(() =>
198+
$`git worktree remove ${worktreePath}`
199+
.cwd(tmp)
200+
.quiet()
201+
.catch(() => {}),
202+
),
203+
)
196204
yield* Effect.promise(() => $`git worktree add ${worktreePath} -b test-branch-${Date.now()}`.cwd(tmp).quiet())
197205

198206
const { project, sandbox } = yield* run((svc) => svc.fromDirectory(worktreePath))
@@ -211,7 +219,14 @@ describe("Project.fromDirectory with worktrees", () => {
211219
const { project: main } = yield* run((svc) => svc.fromDirectory(tmp))
212220

213221
const worktreePath = path.join(tmp, "..", path.basename(tmp) + "-wt-shared")
214-
yield* Effect.addFinalizer(() => Effect.promise(() => $`git worktree remove ${worktreePath}`.cwd(tmp).quiet().catch(() => {})))
222+
yield* Effect.addFinalizer(() =>
223+
Effect.promise(() =>
224+
$`git worktree remove ${worktreePath}`
225+
.cwd(tmp)
226+
.quiet()
227+
.catch(() => {}),
228+
),
229+
)
215230
yield* Effect.promise(() => $`git worktree add ${worktreePath} -b shared-${Date.now()}`.cwd(tmp).quiet())
216231

217232
const { project: wt } = yield* run((svc) => svc.fromDirectory(worktreePath))
@@ -229,10 +244,12 @@ describe("Project.fromDirectory with worktrees", () => {
229244
Effect.gen(function* () {
230245
const tmp = yield* gitTmpdir()
231246

232-
// Create a bare remote, push, then clone into a second directory
247+
// Create a bare remote, push, then clone into a second directory
233248
const bare = tmp + "-bare"
234249
const clone = tmp + "-clone"
235-
yield* Effect.addFinalizer(() => Effect.promise(() => $`rm -rf ${bare} ${clone}`.quiet().nothrow()).pipe(Effect.ignore))
250+
yield* Effect.addFinalizer(() =>
251+
Effect.promise(() => $`rm -rf ${bare} ${clone}`.quiet().nothrow()).pipe(Effect.ignore),
252+
)
236253
yield* Effect.promise(() => $`git clone --bare ${tmp} ${bare}`.quiet())
237254
yield* Effect.promise(() => $`git clone ${bare} ${clone}`.quiet())
238255

@@ -251,8 +268,18 @@ describe("Project.fromDirectory with worktrees", () => {
251268
const worktree2 = path.join(tmp, "..", path.basename(tmp) + "-wt2")
252269
yield* Effect.addFinalizer(() =>
253270
Effect.gen(function* () {
254-
yield* Effect.promise(() => $`git worktree remove ${worktree1}`.cwd(tmp).quiet().catch(() => {}))
255-
yield* Effect.promise(() => $`git worktree remove ${worktree2}`.cwd(tmp).quiet().catch(() => {}))
271+
yield* Effect.promise(() =>
272+
$`git worktree remove ${worktree1}`
273+
.cwd(tmp)
274+
.quiet()
275+
.catch(() => {}),
276+
)
277+
yield* Effect.promise(() =>
278+
$`git worktree remove ${worktree2}`
279+
.cwd(tmp)
280+
.quiet()
281+
.catch(() => {}),
282+
)
256283
}),
257284
)
258285
yield* Effect.promise(() => $`git worktree add ${worktree1} -b branch-${Date.now()}`.cwd(tmp).quiet())
@@ -439,7 +466,9 @@ describe("Project.update", () => {
439466
expect(Exit.isFailure(exit)).toBe(true)
440467
if (Exit.isFailure(exit)) {
441468
const error = Cause.squash(exit.cause)
442-
expect(error instanceof Error ? error.message : String(error)).toContain("Project not found: nonexistent-project-id")
469+
expect(error instanceof Error ? error.message : String(error)).toContain(
470+
"Project not found: nonexistent-project-id",
471+
)
443472
}
444473
}),
445474
)
@@ -577,7 +606,9 @@ describe("Project.fromDirectory with bare repos", () => {
577606
const parentDir = path.dirname(tmp)
578607
const barePath = path.join(parentDir, `bare-${Date.now()}.git`)
579608
const worktreePath = path.join(parentDir, `worktree-${Date.now()}`)
580-
yield* Effect.addFinalizer(() => Effect.promise(() => $`rm -rf ${barePath} ${worktreePath}`.quiet().nothrow()).pipe(Effect.ignore))
609+
yield* Effect.addFinalizer(() =>
610+
Effect.promise(() => $`rm -rf ${barePath} ${worktreePath}`.quiet().nothrow()).pipe(Effect.ignore),
611+
)
581612

582613
yield* Effect.promise(() => $`git clone --bare ${tmp} ${barePath}`.quiet())
583614
yield* Effect.promise(() => $`git worktree add ${worktreePath} HEAD`.cwd(barePath).quiet())
@@ -638,7 +669,9 @@ describe("Project.fromDirectory with bare repos", () => {
638669
const parentDir = path.dirname(tmp)
639670
const barePath = path.join(parentDir, `bare-no-suffix-${Date.now()}`)
640671
const worktreePath = path.join(parentDir, `worktree-${Date.now()}`)
641-
yield* Effect.addFinalizer(() => Effect.promise(() => $`rm -rf ${barePath} ${worktreePath}`.quiet().nothrow()).pipe(Effect.ignore))
672+
yield* Effect.addFinalizer(() =>
673+
Effect.promise(() => $`rm -rf ${barePath} ${worktreePath}`.quiet().nothrow()).pipe(Effect.ignore),
674+
)
642675

643676
yield* Effect.promise(() => $`git clone --bare ${tmp} ${barePath}`.quiet())
644677
yield* Effect.promise(() => $`git worktree add ${worktreePath} HEAD`.cwd(barePath).quiet())

0 commit comments

Comments
 (0)