mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Adding mockery.d.ts
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/// <reference path="mockery.d.ts" />
|
||||
|
||||
import mockery = require('mockery');
|
||||
|
||||
mockery.enable();
|
||||
mockery.enable({});
|
||||
mockery.enable({
|
||||
useCleanCache: true,
|
||||
warnOnReplace: true,
|
||||
warnOnUnregistered: true
|
||||
});
|
||||
|
||||
mockery.disable();
|
||||
|
||||
var fsMock = {
|
||||
stat: (path: any, cb: any) => { /* your mock code */ }
|
||||
};
|
||||
mockery.registerMock('fs', fsMock);
|
||||
|
||||
mockery.deregisterMock('fs');
|
||||
|
||||
mockery.registerSubstitute('fs', 'fs-mock');
|
||||
|
||||
mockery.deregisterSubstitute('fs');
|
||||
|
||||
mockery.registerAllowable('./my-source-under-test');
|
||||
mockery.registerAllowable('./my-source-under-test', true);
|
||||
|
||||
mockery.deregisterAllowable('./my-source-under-test');
|
||||
|
||||
mockery.registerAllowables(['async', 'path', 'util']);
|
||||
|
||||
mockery.deregisterAllowables(['async', 'path', 'util']);
|
||||
|
||||
mockery.deregisterAll();
|
||||
|
||||
mockery.resetCache();
|
||||
|
||||
mockery.warnOnUnregistered(false);
|
||||
|
||||
mockery.warnOnReplace(false);
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for mockery 1.4.0
|
||||
// Project: https://github.com/mfncooper/mockery
|
||||
// Definitions by: jt000 <https://github.com/jt000>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "mockery" {
|
||||
|
||||
module m {
|
||||
interface MockeryEnableArgs {
|
||||
useCleanCache?: boolean;
|
||||
warnOnReplace?: boolean;
|
||||
warnOnUnregistered?: boolean;
|
||||
}
|
||||
|
||||
function enable(args?: MockeryEnableArgs): void;
|
||||
function disable(): void;
|
||||
|
||||
function registerMock(name: string, mock: any): void;
|
||||
function deregisterMock(name: string): void;
|
||||
|
||||
function registerSubstitute(name: string, substitute: string): void;
|
||||
function deregisterSubstitute(name: string): void;
|
||||
|
||||
function registerAllowable(name: string, unhook?: boolean): void;
|
||||
function deregisterAllowable(name: string): void;
|
||||
|
||||
function registerAllowables(names: string[]): void;
|
||||
function deregisterAllowables(names: string[]): void;
|
||||
|
||||
function deregisterAll(): void;
|
||||
function resetCache(): void;
|
||||
function warnOnUnregistered(value: boolean): void;
|
||||
function warnOnReplace(value: boolean): void;
|
||||
|
||||
}
|
||||
|
||||
export = m;
|
||||
}
|
||||
Reference in New Issue
Block a user