/** * The shared test interface, so tests can be run by both runtimes */ export interface ITestBase { test(name: string, fn: () => void): void; assertEquals(actual: unknown, expected: unknown): void; assertNotEquals(actual: unknown, expected: unknown): void; assertStrictEquals(actual: unknown, expected: unknown): void; assertExists(actual: unknown): void; assertInstanceOf(actual: unknown, expectedType: any): void; assertTrue(actual: boolean): void; assertFalse(actual: boolean): void; } /** * The native functions for terminal settings */ export interface IFFI { /** * Get the existing termios settings (for canonical mode) */ tcgetattr(fd: number, termiosPtr: unknown): number; /** * Update the termios settings */ tcsetattr(fd: number, act: number, termiosPtr: unknown): number; /** * Update the termios pointer with raw mode settings */ cfmakeraw(termiosPtr: unknown): void; /** * Convert a TypedArray to an opaque pointer for ffi calls */ getPointer(ta: any): unknown; } /** * Runtime-specific IO streams */ export interface ITerminalIO { /** * The generator function returning chunks of input from the stdin stream */ inputLoop(): AsyncGenerator; /** * Pipe a string to stdout */ write(s: string): Promise; } export interface IRuntime { /** * Set a beforeExit/beforeUnload event handler for the runtime * @param cb - The event handler */ onExit(cb: () => void): void; }