test(tmux): add isolation regression coverage
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Vendored
+16
-8
@@ -1,14 +1,19 @@
|
|||||||
declare module "bun:test" {
|
declare module "bun:test" {
|
||||||
|
type AnyFunction = (...args: any[]) => any
|
||||||
|
|
||||||
interface MockMetadata<TArgs extends unknown[]> {
|
interface MockMetadata<TArgs extends unknown[]> {
|
||||||
calls: TArgs[]
|
calls: TArgs[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MockFunction<TArgs extends unknown[] = unknown[], TReturn = unknown> {
|
interface MockFunction<TFunction extends AnyFunction = AnyFunction> {
|
||||||
(...args: TArgs): TReturn
|
(...args: Parameters<TFunction>): ReturnType<TFunction>
|
||||||
mock: MockMetadata<TArgs>
|
mock: MockMetadata<Parameters<TFunction>>
|
||||||
|
mockClear(): void
|
||||||
mockReset(): void
|
mockReset(): void
|
||||||
mockReturnValue(value: TReturn): void
|
mockRestore(): void
|
||||||
mockResolvedValue(value: Awaited<TReturn>): void
|
mockReturnValue(value: ReturnType<TFunction>): void
|
||||||
|
mockResolvedValue(value: Awaited<ReturnType<TFunction>>): void
|
||||||
|
mockImplementation(fn: TFunction): MockFunction<TFunction>
|
||||||
}
|
}
|
||||||
|
|
||||||
export function describe(name: string, fn: () => void): void
|
export function describe(name: string, fn: () => void): void
|
||||||
@@ -18,9 +23,12 @@ declare module "bun:test" {
|
|||||||
export function afterEach(fn: () => void | Promise<void>): void
|
export function afterEach(fn: () => void | Promise<void>): void
|
||||||
export function beforeAll(fn: () => void | Promise<void>): void
|
export function beforeAll(fn: () => void | Promise<void>): void
|
||||||
export function afterAll(fn: () => void | Promise<void>): void
|
export function afterAll(fn: () => void | Promise<void>): void
|
||||||
export function mock<TArgs extends unknown[], TReturn>(
|
export function mock<TFunction extends AnyFunction>(fn: TFunction): MockFunction<TFunction>
|
||||||
fn: (...args: TArgs) => TReturn,
|
|
||||||
): MockFunction<TArgs, TReturn>
|
export function spyOn<TObject extends object>(
|
||||||
|
object: TObject,
|
||||||
|
key: keyof TObject,
|
||||||
|
): MockFunction<AnyFunction>
|
||||||
|
|
||||||
export namespace mock {
|
export namespace mock {
|
||||||
function module(modulePath: string, factory: () => Record<string, unknown>): void
|
function module(modulePath: string, factory: () => Record<string, unknown>): void
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user