From a2c0d1ebc6ebc284367eedfe0dff3467b1dfc95e Mon Sep 17 00:00:00 2001 From: webbiesdk Date: Mon, 3 Oct 2016 22:18:00 +0200 Subject: [PATCH] Updating jasmine to version 2.5 (#11688) * Updating jasmine to version 2.5 * Fixing 2 small errors in the update of jasmine * withMock now takes a "() => void" * fixed the withMock syntax error * number added as type to seed function --- jasmine/jasmine.d.ts | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 4eb2a054a1..c4151995a7 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jasmine 2.4.1 +// Type definitions for Jasmine 2.5 // Project: http://jasmine.github.io/ // Definitions by: Boris Yankov , Theodore Brown , David Pärsson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -65,6 +65,7 @@ declare namespace jasmine { function addMatchers(matchers: CustomMatcherFactories): void; function stringMatching(str: string): Any; function stringMatching(str: RegExp): Any; + function formatErrorMsg(domain: string, usage: string) : (msg: string) => string interface Any { @@ -115,6 +116,7 @@ declare namespace jasmine { /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */ tick(ms: number): void; mockDate(date?: Date): void; + withMock(func: () => void): void; } interface CustomEqualityTester { @@ -180,9 +182,12 @@ declare namespace jasmine { addMatchers(matchers: CustomMatcherFactories): void; specFilter(spec: Spec): boolean; throwOnExpectationFailure(value: boolean): void; - seed: (s: number) => number; - randomTests: () => boolean; - randomizeTests: (b: boolean) => void; + seed(seed: string | number): string | number; + provideFallbackReporter(reporter: Reporter): void; + throwingExpectationFailures(): boolean; + allowRespy(allow: boolean): void; + randomTests(): boolean; + randomizeTests(b: boolean): void; } interface FakeTimer { @@ -237,6 +242,26 @@ declare namespace jasmine { trace: Trace; } + interface Order { + new (options: {random: boolean, seed: string}): any; + random: boolean; + seed: string; + sort(items: T[]) : T[]; + } + + namespace errors { + class ExpectationFailed extends Error { + constructor(); + stack: any; + } + } + + interface TreeProcessor { + new (attrs: any): any; + execute: (done: Function) => void; + processTree() : any; + } + interface Trace { name: string; message: string; @@ -304,7 +329,9 @@ declare namespace jasmine { toHaveBeenCalledTimes(expected: number): boolean; toContain(expected: any, expectationFailOutput?: any): boolean; toBeLessThan(expected: number, expectationFailOutput?: any): boolean; + toBeLessThanOrEqual(expected: number, expectationFailOutput?: any): boolean; toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean; + toBeGreaterThanOrEqual(expected: number, expectationFailOutput?: any): boolean; toBeCloseTo(expected: number, precision?: any, expectationFailOutput?: any): boolean; toThrow(expected?: any): boolean; toThrowError(message?: string | RegExp): boolean; @@ -374,6 +401,7 @@ declare namespace jasmine { runs(func: SpecFunction): Spec; addToQueue(block: Block): void; addMatcherResult(result: Result): void; + getResult(): any; expect(actual: any): any; waits(timeout: number): Spec; waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec; @@ -383,11 +411,12 @@ declare namespace jasmine { finishCallback(): void; finish(onComplete?: () => void): void; after(doAfter: SpecFunction): void; - execute(onComplete?: () => void): any; + execute(onComplete?: () => void, enabled?: boolean): any; addBeforesAndAftersToQueue(): void; explodes(): void; spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy; removeAllSpies(): void; + throwOnExpectationFailure: boolean; } interface XSpec { @@ -487,6 +516,10 @@ declare namespace jasmine { finished: boolean; result: any; messages: any; + runDetails: { + failedExpectations: ExpectationResult[]; + order: jasmine.Order + } new (): any;