UNPKG

@bomb.sh/tools

Version:

The internal dev, build, and lint CLI for Bombshell projects

54 lines (52 loc) 1.08 kB
import { Readable, Writable } from "node:stream"; //#region src/test-utils/stdio.ts var MockReadable = class extends Readable { _buffer = []; isTTY = false; isRaw = false; setRawMode() { this.isRaw = true; } constructor(config, opts) { super(opts); this.isTTY = config?.isTTY ?? false; } _read() { if (this._buffer === null) { this.push(null); return; } for (const val of this._buffer) this.push(val); this._buffer = []; } pushValue(val) { this._buffer?.push(val); } close() { this._buffer = null; } }; var MockWritable = class extends Writable { buffer = []; isTTY = false; columns = 80; rows = 20; constructor(config, opts) { super(opts); this.isTTY = config?.isTTY ?? false; this.columns = config?.columns ?? 80; this.rows = config?.rows ?? 20; } resize(columns, rows) { this.columns = columns; this.rows = rows; this.emit("resize"); } _write(chunk, _encoding, callback) { this.buffer.push(chunk.toString()); callback(); } }; //#endregion export { MockReadable, MockWritable }; //# sourceMappingURL=stdio.mjs.map