| 1 | // Relative import (not `@/` alias) so this file runs under both Bun and Node |
| 2 | // without a paths-aware loader. This fixture is excluded from the test |
| 3 | // project's typecheck (see tsconfig.test.json) because the relative path |
| 4 | // crosses composite-project boundaries. |
| 5 | import * as Context from "effect/Context"; |
| 6 | import * as Effect from "effect/Effect"; |
| 7 | import * as Layer from "effect/Layer"; |
| 8 | import { launch } from "../../../src/Local/RpcServer.ts"; |
| 9 | |
| 10 | /** |
| 11 | * `RpcServer.launch` fixture that keeps printing on both stdio channels |
| 12 | * after boot, so tests can assert the spawner's log hub forwards sidecar |
| 13 | * output to `/logs` subscribers. |
| 14 | */ |
| 15 | export class TestNoise extends Context.Service< |
| 16 | TestNoise, |
| 17 | { echo: (msg: string) => Effect.Effect<string> } |
| 18 | >()("Test.Noise") {} |
| 19 | |
| 20 | const TestNoiseLive = Layer.succeed(TestNoise, { |
| 21 | echo: (msg) => Effect.succeed(`echo:${msg}`), |
| 22 | }); |
| 23 | |
| 24 | launch(TestNoiseLive); |
| 25 | |
| 26 | setInterval(() => { |
| 27 | console.log("fixture-stdout-ping"); |
| 28 | console.error("fixture-stderr-ping"); |
| 29 | }, 100); |