mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-30 11:14:27 +08:00
Merge pull request #1070 from varju/no-implicit-any
noImplicitAny support for mocha and sinon
This commit is contained in:
Vendored
+8
-8
@@ -4,8 +4,8 @@
|
||||
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Mocha {
|
||||
setup(options: MochaSetupOptions);
|
||||
run(callback: () => void);
|
||||
setup(options: MochaSetupOptions): void;
|
||||
run(callback: () => void): void;
|
||||
}
|
||||
|
||||
interface MochaSetupOptions {
|
||||
@@ -18,7 +18,7 @@ declare var describe : {
|
||||
(description: string, spec: () => void): void;
|
||||
only(description: string, spec: () => void): void;
|
||||
skip(description: string, spec: () => void): void;
|
||||
timeout(ms: number);
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
declare var it: {
|
||||
@@ -28,22 +28,22 @@ declare var it: {
|
||||
only(expectation: string, assertion?: (done: (error?: Error) => void) => void): void;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: (error?: Error) => void) => void): void;
|
||||
timeout(ms: number);
|
||||
timeout(ms: number): void;
|
||||
};
|
||||
|
||||
declare function before(action: () => void): void;
|
||||
|
||||
declare function before(action: (done: (failReason?) => void) => void): void;
|
||||
declare function before(action: (done: (error?: Error) => void) => void): void;
|
||||
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
declare function after(action: (done: (failReason?) => void) => void): void;
|
||||
declare function after(action: (done: (error?: Error) => void) => void): void;
|
||||
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
declare function beforeEach(action: (done: (failReason?) => void) => void): void;
|
||||
declare function beforeEach(action: (done: (error?: Error) => void) => void): void;
|
||||
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
declare function afterEach(action: (done: (failReason?) => void) => void): void;
|
||||
declare function afterEach(action: (done: (error?: Error) => void) => void): void;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="sinon.d.ts" />
|
||||
|
||||
function once(fn) {
|
||||
var returnValue, called = false;
|
||||
function once(fn: Function) {
|
||||
var returnValue: any, called = false;
|
||||
return function () {
|
||||
if (!called) {
|
||||
called = true;
|
||||
@@ -52,7 +52,7 @@ function testFive() {
|
||||
}
|
||||
|
||||
var objectUnderTest: any = {
|
||||
process: function (obj) {
|
||||
process: function (obj: any) {
|
||||
// It doesn't really matter what's here because the stub is going to replace this function
|
||||
var dummy = true;
|
||||
if (dummy) { return obj.success(99); } else { obj.failure(99); }
|
||||
|
||||
Vendored
+10
-10
@@ -60,20 +60,20 @@ interface SinonSpy extends SinonSpyCallApi {
|
||||
calledAfter(anotherSpy: SinonSpy): boolean;
|
||||
calledWithNew(spy: SinonSpy): boolean;
|
||||
withArgs(...args: any[]): SinonSpy;
|
||||
alwaysCalledOn(obj: any);
|
||||
alwaysCalledWith(...args: any[]);
|
||||
alwaysCalledWithExactly(...args: any[]);
|
||||
alwaysCalledWithMatch(...args: SinonMatcher[]);
|
||||
neverCalledWith(...args: any[]);
|
||||
neverCalledWithMatch(...args: SinonMatcher[]);
|
||||
alwaysCalledOn(obj: any): boolean;
|
||||
alwaysCalledWith(...args: any[]): boolean;
|
||||
alwaysCalledWithExactly(...args: any[]): boolean;
|
||||
alwaysCalledWithMatch(...args: SinonMatcher[]): boolean;
|
||||
neverCalledWith(...args: any[]): boolean;
|
||||
neverCalledWithMatch(...args: SinonMatcher[]): boolean;
|
||||
alwaysThrew(): boolean;
|
||||
alwaysThrew(type: string);
|
||||
alwaysThrew(obj: any);
|
||||
alwaysThrew(type: string): boolean;
|
||||
alwaysThrew(obj: any): boolean;
|
||||
alwaysReturned(): boolean;
|
||||
invokeCallback(...args: any[]): void;
|
||||
getCall(n: number): SinonSpyCall;
|
||||
reset(): void;
|
||||
printf(format: string, ...args: any[]);
|
||||
printf(format: string, ...args: any[]): string;
|
||||
restore(): void;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ interface SinonFakeXMLHttpRequest {
|
||||
// Methods
|
||||
restore(): void;
|
||||
useFilters: boolean;
|
||||
addFilter(filter: (method, url, async, username, password) => boolean): void;
|
||||
addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void;
|
||||
setResponseHeaders(headers: any): void;
|
||||
setResponseBody(body: string): void;
|
||||
respond(status: number, headers: any, body: string): void;
|
||||
|
||||
Reference in New Issue
Block a user