diff options
| author | Kit Langton <[email protected]> | 2026-04-30 21:36:19 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-30 21:36:19 -0400 |
| commit | e8a194a2bb39515546b0340151d1a1631e537bff (patch) | |
| tree | 28a5bb575b8180fd36dbadd1036150599541b912 | |
| parent | 8aa8798e076b7f3ca40c8dd0b34256413e049dae (diff) | |
| download | opencode-e8a194a2bb39515546b0340151d1a1631e537bff.tar.gz opencode-e8a194a2bb39515546b0340151d1a1631e537bff.zip | |
test(effect): stabilize runner active shell check (#25203)
| -rw-r--r-- | packages/opencode/test/effect/runner.test.ts | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/packages/opencode/test/effect/runner.test.ts b/packages/opencode/test/effect/runner.test.ts index 97ca9f616..0f5783bfc 100644 --- a/packages/opencode/test/effect/runner.test.ts +++ b/packages/opencode/test/effect/runner.test.ts @@ -263,14 +263,25 @@ describe("Runner", () => { Effect.gen(function* () { const s = yield* Scope.Scope const runner = Runner.make<string>(s) - const fiber = yield* runner.ensureRunning(Effect.never.pipe(Effect.as("x"))).pipe(Effect.forkChild) - yield* Effect.sleep("10 millis") + const started = yield* Deferred.make<void>() + const fiber = yield* runner + .ensureRunning( + Effect.gen(function* () { + yield* Deferred.succeed(started, undefined) + return yield* Effect.never.pipe(Effect.as("x")) + }), + ) + .pipe(Effect.forkChild) + yield* Deferred.await(started).pipe(Effect.timeout("250 millis")) + yield* Effect.gen(function* () { + while (runner.state._tag !== "Running") yield* Effect.yieldNow + }).pipe(Effect.timeout("250 millis")) const exit = yield* runner.startShell(Effect.succeed("nope")).pipe(Effect.exit) expect(Exit.isFailure(exit)).toBe(true) yield* runner.cancel - yield* Fiber.await(fiber) + yield* Fiber.await(fiber).pipe(Effect.timeout("250 millis")) }), ) |
