import type { ResultError } from "@core/result"; import { type ShellState } from "@core/shell_state"; import { SIGNAL_MAP } from "@core/signal"; import type { SignalTerminationError } from "@core/util/errors"; import { Shell } from "@shell/shell"; import { Fixture } from "@tests/helpers/state_fixture"; import { expect, test } from "vitest"; const state: ShellState = Fixture.State; test("returns a Result of type success", async () => { await Shell.init(state); let result; Shell.Instance?.on("result", payload => { //const decoder = new TextDecoder(); //console.log(decoder.decode(payload.result.stdout.toArray())); //console.log(payload); result = payload.result; expect(result.type).toBe("error"); expect((result as ResultError).error.exitCode).toEqual(130); expect((result as ResultError).error.signalNumber).toEqual(SIGNAL_MAP.SIGINT); }); await Shell.Instance?.execute("async"); Shell.Instance?.sendInput("a"); Shell.Instance?.sendInput("b"); Shell.Instance?.sendInput("c"); Shell.Instance?.sendInput("d"); Shell.Instance?.sendInput( "right now technically anything goes because its just a plain string however i plan on improving this system a bit later on", ); Shell.Instance?.sendInput("ctrl+c"); });