Path: blob/main/core/dash-wasm/src/test/no-stdio.test.ts
1067 views
/*1Test disabling using stdio in node.js.2*/34import { asyncDash } from "../node";5import { delay } from "awaiting";67test("use noStdio", async () => {8const dash = await asyncDash({ noStdio: true });9// capture stdout and stderr to a string. Actual stdout/stderr is a Buffer.10let stdout = "";11dash.kernel.on("stdout", (data) => {12stdout += data.toString();13});1415dash.terminal();1617// send 389 + 507718await dash.kernel.writeToStdin("echo $((389+5077))\n");1920// output is buffered, so it can take a little while before it appears.21const t0 = new Date().valueOf();22while (23new Date().valueOf() - t0 < 5000 &&24!stdout.includes(`${389 + 5077}`)25) {26await delay(50);27}28expect(stdout).toContain(`${389 + 5077}`);2930await dash.kernel.terminate();31});323334