declare type ImplementationCallback = jasmine.ImplementationCallback; declare function describe(description: string, specDefinitions: () => void): void; declare function fdescribe(description: string, specDefinitions: () => void): void; declare function xdescribe(description: string, specDefinitions: () => void): void; declare function it(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void; declare function fit(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void; declare function xit(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void; declare function pending(reason?: string): void; declare function setSpecProperty(key: string, value: unknown): void; declare function setSuiteProperty(key: string, value: unknown): void; declare function beforeEach(action: jasmine.ImplementationCallback, timeout?: number): void; declare function afterEach(action: jasmine.ImplementationCallback, timeout?: number): void; declare function beforeAll(action: jasmine.ImplementationCallback, timeout?: number): void; declare function afterAll(action: jasmine.ImplementationCallback, timeout?: number): void; declare function expect(spy: T | jasmine.Spy): jasmine.FunctionMatchers; declare function expect(actual: ArrayLike): jasmine.ArrayLikeMatchers; declare function expect(actual: T): jasmine.Matchers; declare function expect(): jasmine.NothingMatcher; declare function expectAsync(actual: T | PromiseLike): jasmine.AsyncMatchers; declare function fail(e?: any): void; interface DoneFn extends Function { (): void; fail: (message?: Error | string) => void; } declare function spyOn(object: T, method: T[K] extends Function ? K : never): jasmine.Spy V : never>; declare function spyOnProperty(object: T, property: K, accessType?: "get"): jasmine.Spy<(this: T) => T[K]>; declare function spyOnProperty(object: T, property: K, accessType: "set"): jasmine.Spy<(this: T, value: T[K]) => void>; declare function spyOnAllFunctions(object: T, includeNonEnumerable?: boolean): jasmine.SpyObj; declare namespace jasmine { type Func = (...args: any[]) => any; type Constructor = Function & { prototype: any; }; type ImplementationCallback = (() => PromiseLike) | (() => void) | ((done: DoneFn) => void); type ExpectedRecursive = T | ObjectContaining | AsymmetricMatcher | { [K in keyof T]: ExpectedRecursive | Any; }; type Expected = T | ObjectContaining | AsymmetricMatcher | Any | Spy | { [K in keyof T]: ExpectedRecursive; }; type SpyObjMethodNames = T extends undefined ? ReadonlyArray | { [methodName: string]: any; } : (ReadonlyArray | { [P in keyof T]?: T[P] extends Func ? (ReturnType | (P extends keyof Object ? Object[P] : never)) : any; }); type SpyObjPropertyNames = T extends undefined ? ReadonlyArray | { [propertyName: string]: any; } : ReadonlyArray | { [P in keyof T]?: T[P]; }; interface Configuration { random?: boolean | undefined; seed?: number | string | null | undefined; stopOnSpecFailure?: boolean | undefined; failSpecWithNoExpectations?: boolean | undefined; stopSpecOnExpectationFailure?: boolean | undefined; specFilter?: SpecFilter | undefined; hideDisabled?: boolean | undefined; Promise?: typeof Promise | undefined; autoCleanClosures?: boolean | undefined; } type EnvConfiguration = Configuration; function clock(): Clock; function DiffBuilder(): DiffBuilder; function any(aclass: Constructor | Symbol): AsymmetricMatcher; function anything(): AsymmetricMatcher; function truthy(): AsymmetricMatcher; function falsy(): AsymmetricMatcher; function empty(): AsymmetricMatcher; function notEmpty(): AsymmetricMatcher; function arrayContaining(sample: ArrayLike): ArrayContaining; function arrayWithExactContents(sample: ArrayLike): ArrayContaining; function objectContaining(sample: { [K in keyof T]?: ExpectedRecursive; }): ObjectContaining; function mapContaining(sample: Map): AsymmetricMatcher>; function setContaining(sample: Set): AsymmetricMatcher>; function setDefaultSpyStrategy(fn?: (and: SpyAnd) => void): void; function spyOnGlobalErrorsAsync(fn?: (globalErrorSpy: Error) => Promise): Promise; function addSpyStrategy(name: string, factory: Fn): void; function createSpy(name?: string, originalFn?: Fn): Spy; function createSpyObj(baseName: string, methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any; function createSpyObj(baseName: string, methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): SpyObj; function createSpyObj(methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any; function createSpyObj(methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): SpyObj; function getEnv(): Env; function debugLog(msg: string): void; function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; function addCustomObjectFormatter(formatter: CustomObjectFormatter): void; function addMatchers(matchers: CustomMatcherFactories): void; function addAsyncMatchers(matchers: CustomAsyncMatcherFactories): void; function stringMatching(str: string | RegExp): AsymmetricMatcher; function stringContaining(str: string | RegExp): AsymmetricMatcher; function formatErrorMsg(domain: string, usage: string): (msg: string) => string; interface Any extends AsymmetricMatcher { new (expectedClass: any): any; jasmineToString(prettyPrint: (value: any) => string): string; } interface AsymmetricMatcher { asymmetricMatch(other: TValue, matchersUtil?: MatchersUtil): boolean; jasmineToString?(prettyPrint: (value: any) => string): string; } interface ArrayLike { length: number; [n: number]: T; } interface ArrayContaining extends AsymmetricMatcher { new?(sample: ArrayLike): ArrayLike; jasmineToString(prettyPrint: (value: any) => string): string; } interface ObjectContaining extends AsymmetricMatcher { new?(sample: { [K in keyof T]?: any; }): { [K in keyof T]?: any; }; jasmineToString?(prettyPrint: (value: any) => string): string; } interface Clock { install(): Clock; uninstall(): void; tick(ms: number): void; mockDate(date?: Date): void; withMock(func: () => void): void; } type CustomEqualityTester = (first: any, second: any) => boolean | void; type CustomObjectFormatter = (value: unknown) => string | undefined; interface CustomMatcher { compare(actual: T, expected: T, ...args: any[]): CustomMatcherResult; compare(actual: any, ...expected: any[]): CustomMatcherResult; negativeCompare?(actual: T, expected: T, ...args: any[]): CustomMatcherResult; negativeCompare?(actual: any, ...expected: any[]): CustomMatcherResult; } interface CustomAsyncMatcher { compare(actual: T, expected: T, ...args: any[]): PromiseLike; compare(actual: any, ...expected: any[]): PromiseLike; negativeCompare?(actual: T, expected: T, ...args: any[]): PromiseLike; negativeCompare?(actual: any, ...expected: any[]): PromiseLike; } type CustomMatcherFactory = (util: MatchersUtil) => CustomMatcher; type CustomAsyncMatcherFactory = (util: MatchersUtil) => CustomAsyncMatcher; interface CustomMatcherFactories { [name: string]: CustomMatcherFactory; } interface CustomAsyncMatcherFactories { [name: string]: CustomAsyncMatcherFactory; } interface CustomMatcherResult { pass: boolean; message?: string | undefined; } interface DiffBuilder { setRoots(actual: any, expected: any): void; recordMismatch(formatter?: (actual: any, expected: any, path?: any, prettyPrinter?: any) => string): void; withPath(pathComponent: string, block: () => void): void; getMessage(): string; } interface MatchersUtil { equals(a: any, b: any): boolean; contains(haystack: ArrayLike | string, needle: any): boolean; buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string; pp(value: any): string; } interface Env { addReporter(reporter: CustomReporter): void; allowRespy(allow: boolean): void; clearReporters(): void; configuration(): Configuration; configure(configuration: Configuration): void; execute(runnablesToRun: Suite[] | null | undefined, onComplete: Func): void; execute(runnablesToRun?: Suite[]): PromiseLike; provideFallbackReporter(reporter: CustomReporter): void; setSpecProperty: typeof setSpecProperty; setSuiteProperty: typeof setSuiteProperty; topSuite(): Suite; } interface HtmlReporter { new (): any; } interface HtmlSpecFilter { new (): any; } interface Result { type: string; } interface ExpectationResult extends Result { matcherName: string; message: string; stack: string; passed: boolean; expected: any; actual: any; } interface DeprecationWarning extends Result { message: string; stack: string; } interface Order { new (options: { random: boolean; seed: number | string; }): any; random: boolean; seed: number | string; sort(items: T[]): T[]; } namespace errors { class ExpectationFailed extends Error { constructor(); stack: any; } } interface Matchers { toBe(expected: Expected): void; toBe(expected: Expected, expectationFailOutput: any): void; toEqual(expected: Expected): void; toEqual(expected: Expected, expectationFailOutput: any): void; toMatch(expected: string | RegExp): void; toMatch(expected: string | RegExp, expectationFailOutput: any): void; toBeDefined(): void; toBeDefined(expectationFailOutput: any): void; toBeUndefined(): void; toBeUndefined(expectationFailOutput: any): void; toBeNull(): void; toBeNull(expectationFailOutput: any): void; toBeNaN(): void; toBeTruthy(): void; toBeTruthy(expectationFailOutput: any): void; toBeFalsy(): void; toBeFalsy(expectationFailOutput: any): void; toBeTrue(): void; toBeFalse(): void; toHaveBeenCalled(): void; toHaveBeenCalledBefore(expected: Func): void; toHaveBeenCalledWith(...params: any[]): void; toHaveBeenCalledOnceWith(...params: any[]): void; toHaveBeenCalledTimes(expected: number): void; toContain(expected: any): void; toContain(expected: any, expectationFailOutput: any): void; toBeLessThan(expected: number): void; toBeLessThan(expected: number, expectationFailOutput: any): void; toBeLessThanOrEqual(expected: number): void; toBeLessThanOrEqual(expected: number, expectationFailOutput: any): void; toBeGreaterThan(expected: number): void; toBeGreaterThan(expected: number, expectationFailOutput: any): void; toBeGreaterThanOrEqual(expected: number): void; toBeGreaterThanOrEqual(expected: number, expectationFailOutput: any): void; toBeCloseTo(expected: number, precision?: any): void; toBeCloseTo(expected: number, precision: any, expectationFailOutput: any): void; toThrow(expected?: any): void; toThrowError(message?: string | RegExp): void; toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): void; toThrowMatching(predicate: (thrown: any) => boolean): void; toBeNegativeInfinity(): void; toBeNegativeInfinity(expectationFailOutput: any): void; toBePositiveInfinity(): void; toBePositiveInfinity(expectationFailOutput: any): void; toBeInstanceOf(expected: Constructor): void; toHaveClass(expected: string): void; toHaveClass(expected: string, expectationFailOutput: any): void; toHaveSize(expected: number): void; toHaveSpyInteractions(): void; withContext(message: string): Matchers; not: Matchers; } interface ArrayLikeMatchers extends Matchers> { toBe(expected: Expected> | ArrayContaining): void; toBe(expected: Expected> | ArrayContaining, expectationFailOutput: any): void; toEqual(expected: Expected> | ArrayContaining): void; toEqual(expected: Expected> | ArrayContaining, expectationFailOutput: any): void; toContain(expected: Expected): void; toContain(expected: Expected, expectationFailOutput: any): void; withContext(message: string): ArrayLikeMatchers; not: ArrayLikeMatchers; } type MatchableArgs = Fn extends (...args: infer P) => any ? { [K in keyof P]: Expected; } : never; interface FunctionMatchers extends Matchers { toHaveBeenCalledWith(...params: MatchableArgs): void; toHaveBeenCalledOnceWith(...params: MatchableArgs): void; withContext(message: string): FunctionMatchers; not: FunctionMatchers; } interface NothingMatcher { nothing(): void; } interface AsyncMatchers { toBePending(): PromiseLike; toBePending(expectationFailOutput: any): PromiseLike; toBeResolved(): PromiseLike; toBeResolved(expectationFailOutput: any): PromiseLike; toBeRejected(): PromiseLike; toBeRejected(expectationFailOutput: any): PromiseLike; toBeResolvedTo(expected: Expected): PromiseLike; toBeRejectedWith(expected: Expected): PromiseLike; toBeRejectedWithError(expected?: new (...args: any[]) => Error, message?: string | RegExp): PromiseLike; toBeRejectedWithError(message?: string | RegExp): PromiseLike; withContext(message: string): AsyncMatchers; already: AsyncMatchers; not: AsyncMatchers; } interface JasmineStartedInfo { totalSpecsDefined: number; order: Order; } interface CustomReportExpectation { matcherName: string; message: string; passed: boolean; stack: string; } interface FailedExpectation extends CustomReportExpectation { actual: string; expected: string; } interface PassedExpectation extends CustomReportExpectation { } interface DeprecatedExpectation { message: string; } interface SuiteResult { id: string; description: string; fullName: string; failedExpectations: FailedExpectation[]; deprecationWarnings: DeprecatedExpectation[]; status: string; duration: number | null; properties: { [key: string]: unknown; } | null; } interface SpecResult extends SuiteResult { passedExpectations: PassedExpectation[]; pendingReason: string; debugLogs: DebugLogEntry[] | null; } interface DebugLogEntry { message: String; timestamp: number; } interface JasmineDoneInfo { overallStatus: string; totalTime: number; incompleteReason: string; order: Order; failedExpectations: ExpectationResult[]; deprecationWarnings: ExpectationResult[]; } type SuiteInfo = JasmineStartedInfo; type CustomReporterResult = SuiteResult & SpecResult; type RunDetails = JasmineDoneInfo; interface CustomReporter { jasmineStarted?(suiteInfo: JasmineStartedInfo, done?: () => void): void | Promise; suiteStarted?(result: SuiteResult, done?: () => void): void | Promise; specStarted?(result: SpecResult, done?: () => void): void | Promise; specDone?(result: SpecResult, done?: () => void): void | Promise; suiteDone?(result: SuiteResult, done?: () => void): void | Promise; jasmineDone?(runDetails: JasmineDoneInfo, done?: () => void): void | Promise; } interface SpecFilter { (spec: Spec): boolean; } type SpecFunction = (spec?: Spec) => void; interface Spec { new (attrs: any): any; readonly id: number; env: Env; readonly description: string; getFullName(): string; } interface Suite extends Spec { parentSuite: Suite; children: Array; } interface Spy { (...params: Parameters): ReturnType; and: SpyAnd; calls: Calls; withArgs(...args: MatchableArgs): Spy; } type SpyObj = T & { [K in keyof T]: T[K] extends Func ? T[K] & Spy : T[K]; }; function isSpy(putativeSpy: Func): putativeSpy is Spy; type NonTypedSpyObj = SpyObj<{ [K in keyof T]: T[K] extends Func ? Func : T[K]; }>; type PromisedResolveType = T extends PromiseLike ? TResult : never; type PromisedRejectType = T extends PromiseLike ? any : never; interface SpyAnd { identity: string; callThrough(): Spy; returnValue(val: ReturnType): Spy; returnValues(...values: Array>): Spy; callFake(fn: Fn): Spy; resolveTo(val?: PromisedResolveType>): Spy; rejectWith(val?: PromisedRejectType>): Spy; throwError(msg: string | Error): Spy; stub(): Spy; } interface Calls { any(): boolean; count(): number; argsFor(index: number): Parameters; allArgs(): ReadonlyArray>; all(): ReadonlyArray>; mostRecent(): CallInfo; first(): CallInfo; reset(): void; saveArgumentsByValue(): void; thisFor(index: number): ThisType; } interface CallInfo { object: ThisType; args: Parameters; returnValue: ReturnType; } interface Util { inherit(childClass: Function, parentClass: Function): any; formatException(e: any): any; htmlEscape(str: string): string; argsToArray(args: any): any; extend(destination: any, source: any): any; } interface JsApiReporter extends CustomReporter { new (): any; started: boolean; finished: boolean; runDetails: JasmineDoneInfo; status(): string; suiteResults(index: number, length: number): SuiteResult[]; specResults(index: number, length: number): SpecResult[]; suites(): { [id: string]: SuiteResult; }; specs(): SpecResult[]; executionTime(): number; } interface Jasmine { Spec: Spec; clock: Clock; util: Util; } var HtmlReporter: HtmlReporter; var HtmlSpecFilter: HtmlSpecFilter; var DEFAULT_TIMEOUT_INTERVAL: number; var MAX_PRETTY_PRINT_ARRAY_LENGTH: number; var MAX_PRETTY_PRINT_CHARS: number; var MAX_PRETTY_PRINT_DEPTH: number; var version: string; interface JasmineOptions { projectBaseDir?: string; } interface JasmineConfig { failSpecWithNoExpectations?: boolean; helpers?: string[]; jsLoader?: "require" | "import"; random?: boolean; requires?: string[]; spec_dir?: string; spec_files?: string[]; stopOnSpecFailure?: boolean; stopSpecOnExpectationFailure?: boolean; } interface DefaultReporterOptions { timer?: any; print?: (...args: any[]) => void; showColors?: boolean; jasmineCorePath?: string; } } declare module "jasmine" { class jasmine { jasmine: jasmine.Jasmine; env: jasmine.Env; reportersCount: number; reporter: jasmine.CustomReporter; showingColors: boolean; projectBaseDir: string; specDir: string; specFiles: string[]; helperFiles: string[]; requires: string[]; defaultReporterConfigured: boolean; constructor(options?: jasmine.JasmineOptions); addMatchers(matchers: jasmine.CustomMatcherFactories): void; addReporter(reporter: jasmine.CustomReporter): void; addSpecFile(filePath: string): void; addMatchingSpecFiles(patterns: string[]): void; addHelperFile(filePath: string): void; addMatchingHelperFiles(patterns: string[]): void; addRequires(files: string[]): void; configureDefaultReporter(options: jasmine.DefaultReporterOptions): void; execute(files?: string[], filterString?: string): Promise; exitOnCompletion: boolean; loadConfig(config: jasmine.JasmineConfig): void; loadConfigFile(configFilePath?: string): void; loadHelpers(): Promise; loadSpecs(): Promise; loadRequires(): void; provideFallbackReporter(reporter: jasmine.CustomReporter): void; clearReporters(): void; randomizeTests(value: boolean): void; seed(value: number): void; showColors(value: boolean): void; stopSpecOnExpectationFailure(value: boolean): void; stopOnSpecFailure(value: boolean): void; static ConsoleReporter(): any; coreVersion(): string; } export = jasmine; }