UNPKG

@fgv/ts-utils-jest

Version:

Custom matchers for ts-utils result class

67 lines (60 loc) 1.58 kB
/** * @public */ declare interface IMockFileConfig { path: string; backingFile?: string; payload?: string; writable?: boolean; } /** * @public */ declare interface IMockFileSystemOptions { mockWriteOnly?: boolean; allowUnknownMockWrite?: boolean; } /** * @public */ declare class MockFileSystem { protected readonly _options?: IMockFileSystemOptions; protected readonly _config: Map<string, IMockFileConfig>; protected readonly _data: Map<string, string>; protected readonly _realReadFileSync: ReadFunc; protected readonly _extraWrites: string[]; constructor(configs: Iterable<IMockFileConfig>, options?: IMockFileSystemOptions); readMockFileSync(wanted: string): string; writeMockFileSync(wanted: string, body: string): void; getExtraFilesWritten(): string[]; tryGetPayload(want: string): string | undefined; reset(): void; startSpies(): ReadWriteSpies; } declare namespace MockFs { export { IMockFileConfig, ReadWriteSpies, IMockFileSystemOptions, MockFileSystem } } export { MockFs } /** * @public */ declare type ReadFunc = (path: string | number | Buffer | URL, options?: { encoding?: null; flag?: string; } | null) => Buffer; /** * @public */ declare class ReadWriteSpies { readonly read: jest.SpyInstance; readonly write: jest.SpyInstance; constructor(read: jest.SpyInstance, write: jest.SpyInstance); clear(): void; restore(): void; } export { }