MCPcopy Create free account
hub / github.com/Effect-TS/effect / assertOpenResult

Function assertOpenResult

packages/platform/deno/test/DenoTerminal.test.ts:22–42  ·  view source on GitHub ↗
(mode: string, input: string, expected: string)

Source from the content-addressed store, hash-verified

20}
21
22const assertOpenResult = (mode: string, input: string, expected: string) =>
23 Effect.callback<void>((resume) => {
24 const child = spawn(Deno.execPath(), [fixture, mode])
25 let stderr = ""
26 child.stderr.setEncoding("utf8")
27 child.stderr.on("data", (data) => {
28 stderr += data
29 if (stderr.includes("RESULT ")) {
30 child.stdin.end()
31 }
32 })
33 child.on("exit", (code) => {
34 resume(
35 code === 0 && stderr.includes(`RESULT ${expected}`)
36 ? Effect.void
37 : Effect.die(new Error(stderr))
38 )
39 })
40 child.stdin.write(input)
41 return Effect.sync(() => child.kill())
42 })
43
44const assertInteropResult = Effect.callback<void>((resume) => {
45 const child = spawn(Deno.execPath(), [fixture, "interop"])

Callers 1

Calls 6

onMethod · 0.65
endMethod · 0.65
writeMethod · 0.65
spawnFunction · 0.50
resumeFunction · 0.50
syncMethod · 0.45

Tested by

no test coverage detected