diff --git a/packages/core/test/mock-readable.ts b/packages/core/test/mock-readable.ts index 30a5b19..b08e487 100644 --- a/packages/core/test/mock-readable.ts +++ b/packages/core/test/mock-readable.ts @@ -1,12 +1,7 @@ -import { ReadStream } from 'node:tty'; +import { Readable } from 'node:stream'; -export class MockReadable extends ReadStream { +export class MockReadable extends Readable { protected _buffer: unknown[] | null = []; - fd = 0 as const; - - constructor() { - super(0); - } _read() { if (this._buffer === null) { diff --git a/packages/core/test/mock-writable.ts b/packages/core/test/mock-writable.ts index 02bfbd6..78a8902 100644 --- a/packages/core/test/mock-writable.ts +++ b/packages/core/test/mock-writable.ts @@ -1,12 +1,7 @@ -import { WriteStream } from 'node:tty'; +import { Writable } from 'node:stream'; -export class MockWritable extends WriteStream { +export class MockWritable extends Writable { public buffer: string[] = []; - fd = 1 as const; - - constructor() { - super(1); - } // biome-ignore lint/suspicious/noExplicitAny: any is the official type _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null | undefined) => void): void { diff --git a/packages/core/test/prompts/prompt.test.ts b/packages/core/test/prompts/prompt.test.ts index 386a598..e5a6e78 100644 --- a/packages/core/test/prompts/prompt.test.ts +++ b/packages/core/test/prompts/prompt.test.ts @@ -1,6 +1,6 @@ -import { describe, expect, test, afterEach, beforeEach, vi } from 'vitest'; -import { default as Prompt, isCancel } from '../../src/prompts/prompt.js'; import { cursor } from 'sisteransi'; +import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'; +import { default as Prompt, isCancel } from '../../src/prompts/prompt.js'; import { MockReadable } from '../mock-readable.js'; import { MockWritable } from '../mock-writable.js'; diff --git a/packages/core/test/utils.test.ts b/packages/core/test/utils.test.ts index 130d0ea..5d387fb 100644 --- a/packages/core/test/utils.test.ts +++ b/packages/core/test/utils.test.ts @@ -14,6 +14,7 @@ describe('utils', () => { test('clears output on keypress', () => { const input = new MockReadable(); const output = new MockWritable(); + // @ts-ignore const callback = block({ input, output }); const event: Key = { @@ -28,6 +29,7 @@ describe('utils', () => { test('clears output vertically when return pressed', () => { const input = new MockReadable(); const output = new MockWritable(); + // @ts-ignore const callback = block({ input, output }); const event: Key = { @@ -42,6 +44,7 @@ describe('utils', () => { test('ignores additional keypresses after dispose', () => { const input = new MockReadable(); const output = new MockWritable(); + // @ts-ignore const callback = block({ input, output }); const event: Key = { @@ -58,9 +61,11 @@ describe('utils', () => { const input = new MockReadable(); const output = new MockWritable(); // purposely don't keep the callback since we would exit the process + // @ts-ignore block({ input, output }); + // @ts-ignore const spy = vi.spyOn(process, 'exit').mockImplementation(() => { - throw undefined; + return }); const event: Key = { @@ -75,6 +80,7 @@ describe('utils', () => { test('does not clear if overwrite=false', () => { const input = new MockReadable(); const output = new MockWritable(); + // @ts-ignore const callback = block({ input, output, overwrite: false }); const event: Key = {