Skip to content

Instantly share code, notes, and snippets.

@muratg
Created November 28, 2012 05:48
Show Gist options
  • Save muratg/4159283 to your computer and use it in GitHub Desktop.
Save muratg/4159283 to your computer and use it in GitHub Desktop.
TypeScript declarations (typings) file for Jasmine JavaScript testing framework
// jasmine.d.ts -- Declarations for jasmine >= 1.0.26
//
// Jasmine (c) Pivotal Labs
//
// Hand written by Murat Girgin
// based on Jasmine specs: http://pivotal.github.com/jasmine/
// initial code from: http://chutzpah.codeplex.com/discussions/398033
//
declare interface Matcher {
not: Matcher;
toBe(any): any;
toEqual(any): any;
toMatch(RegExp): any;
toBeDefined(): any;
toBeUndefined(): any;
toBeNull(): any;
toBeTruthy(): any;
toBeFalsy(): any;
toContain(any): any;
toBeLessThan(number): any;
toBeGreaterThan(number): any;
toBeCloseTo(number): any;
toThrow(): any;
toHaveBeenCalled(): any;
toHaveBeenCalledWith(...params: any[]): any;
}
declare module jasmine {
export function any(x:any): any;
export function createSpy(name: string): any;
export function createSpyObj(objName: string, spyFunctionNames: string[]): any;
// Clock is broken in node.js: https://github.com/mhevery/jasmine-node/issues/171
// declare interface ClockObj {
// useMock(): any;
// tick(msecs: number): any;
// }
// export var Clock: ClockObj;
}
declare function describe(testDescription: string, f: Function) : any ;
declare function it(testDescription: string, f: Function) : any ;
declare function xdescribe(testDescription: string, f: Function) : any ;
declare function xit(testDescription: string, f: Function) : any ;
declare function expect(actual: any): Matcher;
declare function beforeEach(f: Function): any;
declare function afterEach(f: Function): any;
declare function runs(f: Function): any;
declare function waitsFor(f: Function, description: string, timeout: number): any;
declare function spyOn(obj: any, funcName: string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment