UNPKG

51.5 kBTypeScriptView Raw
1// Type definitions for Jasmine 3.9
2// Project: http://jasmine.github.io
3// Definitions by: Boris Yankov <https://github.com/borisyankov>
4// Theodore Brown <https://github.com/theodorejb>
5// David Pärsson <https://github.com/davidparsson>
6// Lukas Zech <https://github.com/lukas-zech-software>
7// Boris Breuer <https://github.com/Engineer2B>
8// Chris Yungmann <https://github.com/cyungmann>
9// Giles Roadnight <https://github.com/Roaders>
10// Yaroslav Admin <https://github.com/devoto13>
11// Domas Trijonis <https://github.com/fdim>
12// Moshe Kolodny <https://github.com/kolodny>
13// Stephen Farrar <https://github.com/stephenfarrar>
14// Dominik Ehrenberg <https://github.com/djungowski>
15// Chives <https://github.com/chivesrs>
16// kirjs <https://github.com/kirjs>
17// Md. Enzam Hossain <https://github.com/ienzam>
18// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
19
20// For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts
21
22/**
23 * @deprecated Use {@link jasmine.ImplementationCallback} instead.
24 */
25type ImplementationCallback = jasmine.ImplementationCallback;
26
27/**
28 * Create a group of specs (often called a suite).
29 * @param description Textual description of the group
30 * @param specDefinitions Function for Jasmine to invoke that will define inner suites a specs
31 */
32declare function describe(description: string, specDefinitions: () => void): void;
33
34/**
35 * A focused `describe`. If suites or specs are focused, only those that are focused will be executed.
36 * @param description Textual description of the group
37 * @param specDefinitions Function for Jasmine to invoke that will define inner suites a specs
38 */
39declare function fdescribe(description: string, specDefinitions: () => void): void;
40
41/**
42 * A temporarily disabled `describe`. Specs within an xdescribe will be marked pending and not executed.
43 * @param description Textual description of the group
44 * @param specDefinitions Function for Jasmine to invoke that will define inner suites a specs
45 */
46declare function xdescribe(description: string, specDefinitions: () => void): void;
47
48/**
49 * Define a single spec. A spec should contain one or more expectations that test the state of the code.
50 * A spec whose expectations all succeed will be passing and a spec with any failures will fail.
51 * @param expectation Textual description of what this spec is checking
52 * @param assertion Function that contains the code of your test. If not provided the test will be pending.
53 * @param timeout Custom timeout for an async spec.
54 */
55declare function it(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void;
56
57/**
58 * A focused `it`. If suites or specs are focused, only those that are focused will be executed.
59 * @param expectation Textual description of what this spec is checking
60 * @param assertion Function that contains the code of your test. If not provided the test will be pending.
61 * @param timeout Custom timeout for an async spec.
62 */
63declare function fit(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void;
64
65/**
66 * A temporarily disabled `it`. The spec will report as pending and will not be executed.
67 * @param expectation Textual description of what this spec is checking
68 * @param assertion Function that contains the code of your test. If not provided the test will be pending.
69 * @param timeout Custom timeout for an async spec.
70 */
71declare function xit(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void;
72
73/**
74 * Mark a spec as pending, expectation results will be ignored.
75 * If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending.
76 * @param reason Reason the spec is pending.
77 */
78declare function pending(reason?: string): void;
79
80/**
81 * Sets a user-defined property that will be provided to reporters as
82 * part of the properties field of SpecResult.
83 * @since 3.6.0
84 */
85declare function setSpecProperty(key: string, value: unknown): void;
86
87/**
88 * Sets a user-defined property that will be provided to reporters as
89 * part of the properties field of SuiteResult.
90 * @since 3.6.0
91 */
92declare function setSuiteProperty(key: string, value: unknown): void;
93
94/**
95 * Run some shared setup before each of the specs in the describe in which it is called.
96 * @param action Function that contains the code to setup your specs.
97 * @param timeout Custom timeout for an async beforeEach.
98 */
99declare function beforeEach(action: jasmine.ImplementationCallback, timeout?: number): void;
100
101/**
102 * Run some shared teardown after each of the specs in the describe in which it is called.
103 * @param action Function that contains the code to teardown your specs.
104 * @param timeout Custom timeout for an async afterEach.
105 */
106declare function afterEach(action: jasmine.ImplementationCallback, timeout?: number): void;
107
108/**
109 * Run some shared setup once before all of the specs in the describe are run.
110 * Note: Be careful, sharing the setup from a beforeAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail.
111 * @param action Function that contains the code to setup your specs.
112 * @param timeout Custom timeout for an async beforeAll.
113 */
114declare function beforeAll(action: jasmine.ImplementationCallback, timeout?: number): void;
115
116/**
117 * Run some shared teardown once before all of the specs in the describe are run.
118 * Note: Be careful, sharing the teardown from a afterAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail.
119 * @param action Function that contains the code to teardown your specs.
120 * @param timeout Custom timeout for an async afterAll
121 */
122declare function afterAll(action: jasmine.ImplementationCallback, timeout?: number): void;
123
124/**
125 * Create an expectation for a spec.
126 * @checkReturnValue see https://tsetse.info/check-return-value
127 * @param spy
128 */
129declare function expect<T extends jasmine.Func>(spy: T | jasmine.Spy<T>): jasmine.FunctionMatchers<T>;
130
131/**
132 * Create an expectation for a spec.
133 * @checkReturnValue see https://tsetse.info/check-return-value
134 * @param actual
135 */
136declare function expect<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
137
138/**
139 * Create an expectation for a spec.
140 * @checkReturnValue see https://tsetse.info/check-return-value
141 * @param actual Actual computed value to test expectations against.
142 */
143declare function expect<T>(actual: T): jasmine.Matchers<T>;
144
145/**
146 * Create an expectation for a spec.
147 */
148declare function expect(): jasmine.NothingMatcher;
149
150/**
151 * Create an asynchronous expectation for a spec. Note that the matchers
152 * that are provided by an asynchronous expectation all return promises
153 * which must be either returned from the spec or waited for using `await`
154 * in order for Jasmine to associate them with the correct spec.
155 * @checkReturnValue see https://tsetse.info/check-return-value
156 * @param actual Actual computed value to test expectations against.
157 */
158declare function expectAsync<T, U>(actual: T | PromiseLike<T>): jasmine.AsyncMatchers<T, U>;
159
160/**
161 * Explicitly mark a spec as failed.
162 * @param e Reason for the failure
163 */
164declare function fail(e?: any): void;
165
166/**
167 * Action method that should be called when the async work is complete.
168 */
169interface DoneFn extends Function {
170 (): void;
171
172 /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */
173 fail: (message?: Error | string) => void;
174}
175
176/**
177 * Install a spy onto an existing object.
178 * @param object The object upon which to install the `Spy`.
179 * @param method The name of the method to replace with a `Spy`.
180 */
181declare function spyOn<T, K extends keyof T = keyof T>(
182 object: T,
183 method: T[K] extends Function ? K : never,
184): jasmine.Spy<
185 T[K] extends jasmine.Func ? T[K] : T[K] extends { new (...args: infer A): infer V } ? (...args: A) => V : never
186>;
187
188/**
189 * Install a spy on a property installed with `Object.defineProperty` onto an existing object.
190 * @param object The object upon which to install the `Spy`.
191 * @param property The name of the property to replace with a `Spy`.
192 * @param accessType The access type (get|set) of the property to `Spy` on.
193 */
194declare function spyOnProperty<T>(object: T, property: keyof T, accessType?: "get" | "set"): jasmine.Spy;
195
196/**
197 * Installs spies on all writable and configurable properties of an object.
198 * @param object The object upon which to install the `Spy`s.
199 * @param includeNonEnumerable Whether or not to add spies to non-enumerable properties.
200 */
201declare function spyOnAllFunctions<T>(object: T, includeNonEnumerable?: boolean): jasmine.SpyObj<T>;
202
203declare namespace jasmine {
204 type Func = (...args: any[]) => any;
205
206 // Use trick with prototype to allow abstract classes.
207 // More info: https://stackoverflow.com/a/38642922/2009373
208 type Constructor = Function & { prototype: any };
209
210 type ImplementationCallback = (() => PromiseLike<any>) | (() => void) | ((done: DoneFn) => void);
211
212 type ExpectedRecursive<T> =
213 | T
214 | ObjectContaining<T>
215 | AsymmetricMatcher<any>
216 | {
217 [K in keyof T]: ExpectedRecursive<T[K]> | Any;
218 };
219 type Expected<T> =
220 | T
221 | ObjectContaining<T>
222 | AsymmetricMatcher<any>
223 | Any
224 | Spy
225 | {
226 [K in keyof T]: ExpectedRecursive<T[K]>;
227 };
228 type SpyObjMethodNames<T = undefined> = T extends undefined
229 ? ReadonlyArray<string> | { [methodName: string]: any }
230 : ReadonlyArray<keyof T> | { [P in keyof T]?: T[P] extends Func ? ReturnType<T[P]> : any };
231
232 type SpyObjPropertyNames<T = undefined> = T extends undefined
233 ? ReadonlyArray<string> | { [propertyName: string]: any }
234 : ReadonlyArray<keyof T> | { [P in keyof T]?: T[P] };
235
236 /**
237 * Configuration that can be used when configuring Jasmine via {@link jasmine.Env.configure}
238 */
239 interface Configuration {
240 /**
241 * Whether to randomize spec execution order
242 * @since 3.3.0
243 * @default true
244 */
245 random?: boolean | undefined;
246 /**
247 * Seed to use as the basis of randomization.
248 * Null causes the seed to be determined randomly at the start of execution.
249 * @since 3.3.0
250 * @default null
251 */
252 seed?: number | string | null | undefined;
253 /**
254 * Whether to stop execution of the suite after the first spec failure
255 * @since 3.3.0
256 * @default false
257 * @deprecated Use the `stopOnSpecFailure` config property instead.
258 */
259 failFast?: boolean | undefined;
260 /**
261 * Whether to stop execution of the suite after the first spec failure
262 * @since 3.9.0
263 * @default false
264 */
265 stopOnSpecFailure?: boolean | undefined;
266 /**
267 * Whether to fail the spec if it ran no expectations. By default
268 * a spec that ran no expectations is reported as passed. Setting this
269 * to true will report such spec as a failure.
270 * @since 3.5.0
271 * @default false
272 */
273 failSpecWithNoExpectations?: boolean | undefined;
274 /**
275 * Whether to cause specs to only have one expectation failure.
276 * @since 3.3.0
277 * @default false
278 * @deprecated Use the `stopSpecOnExpectationFailure` config property instead.
279 */
280 oneFailurePerSpec?: boolean | undefined;
281 /**
282 * Whether to cause specs to only have one expectation failure.
283 * @since 3.3.0
284 * @default false
285 */
286 stopSpecOnExpectationFailure?: boolean | undefined;
287 /**
288 * Function to use to filter specs
289 * @since 3.3.0
290 * @default A function that always returns true.
291 */
292 specFilter?: SpecFilter | undefined;
293 /**
294 * Whether or not reporters should hide disabled specs from their output.
295 * Currently only supported by Jasmine's HTMLReporter
296 * @since 3.3.0
297 * @default false
298 */
299 hideDisabled?: boolean | undefined;
300 /**
301 * Set to provide a custom promise library that Jasmine will use if it needs
302 * to create a promise. If not set, it will default to whatever global Promise
303 * library is available (if any).
304 * @since 3.5.0
305 * @default undefined
306 */
307 Promise?: typeof Promise | undefined;
308 }
309
310 /** @deprecated Please use `Configuration` instead of `EnvConfiguration`. */
311 type EnvConfiguration = Configuration;
312
313 function clock(): Clock;
314 function DiffBuilder(): DiffBuilder;
315
316 var matchersUtil: MatchersUtil;
317
318 /**
319 * That will succeed if the actual value being compared is an instance of the specified class/constructor.
320 */
321 function any(aclass: Constructor | Symbol): AsymmetricMatcher<any>;
322
323 /**
324 * That will succeed if the actual value being compared is not `null` and not `undefined`.
325 */
326 function anything(): AsymmetricMatcher<any>;
327
328 /**
329 * That will succeed if the actual value being compared is `true` or anything truthy.
330 * @since 3.1.0
331 */
332 function truthy(): AsymmetricMatcher<any>;
333
334 /**
335 * That will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
336 * @since 3.1.0
337 */
338 function falsy(): AsymmetricMatcher<any>;
339
340 /**
341 * That will succeed if the actual value being compared is empty.
342 * @since 3.1.0
343 */
344 function empty(): AsymmetricMatcher<any>;
345
346 /**
347 * That will succeed if the actual value being compared is not empty.
348 * @since 3.1.0
349 */
350 function notEmpty(): AsymmetricMatcher<any>;
351
352 function arrayContaining<T>(sample: ArrayLike<T>): ArrayContaining<T>;
353 function arrayWithExactContents<T>(sample: ArrayLike<T>): ArrayContaining<T>;
354 function objectContaining<T>(sample: { [K in keyof T]?: ExpectedRecursive<T[K]> }): ObjectContaining<T>;
355 function mapContaining<K, V>(sample: Map<K, V>): AsymmetricMatcher<Map<K, V>>;
356 function setContaining<T>(sample: Set<T>): AsymmetricMatcher<Set<T>>;
357
358 function setDefaultSpyStrategy<Fn extends Func = Func>(fn?: (and: SpyAnd<Fn>) => void): void;
359 function addSpyStrategy<Fn extends Func = Func>(name: string, factory: Fn): void;
360 function createSpy<Fn extends Func>(name?: string, originalFn?: Fn): Spy<Fn>;
361 function createSpyObj(baseName: string, methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any;
362 function createSpyObj<T>(
363 baseName: string,
364 methodNames: SpyObjMethodNames<T>,
365 propertyNames?: SpyObjPropertyNames<T>,
366 ): SpyObj<T>;
367 function createSpyObj(methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any;
368 function createSpyObj<T>(methodNames: SpyObjMethodNames<T>, propertyNames?: SpyObjPropertyNames<T>): SpyObj<T>;
369
370 function pp(value: any): string;
371
372 function getEnv(): Env;
373
374 function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
375
376 /**
377 * Add a custom object formatter for the current scope of specs.
378 * Note: This is only callable from within a beforeEach, it, or beforeAll.
379 * @since 3.6.0
380 * @see https://jasmine.github.io/tutorials/custom_object_formatters
381 */
382 function addCustomObjectFormatter(formatter: CustomObjectFormatter): void;
383
384 function addMatchers(matchers: CustomMatcherFactories): void;
385 function addAsyncMatchers(matchers: CustomAsyncMatcherFactories): void;
386
387 function stringMatching(str: string | RegExp): AsymmetricMatcher<string>;
388
389 /**
390 * @deprecated Private method that may be changed or removed in the future
391 */
392 function formatErrorMsg(domain: string, usage: string): (msg: string) => string;
393
394 interface Any extends AsymmetricMatcher<any> {
395 new (expectedClass: any): any;
396 jasmineToString(prettyPrint: typeof pp): string;
397 }
398
399 interface AsymmetricMatcher<TValue> {
400 /**
401 * customTesters are deprecated and will be replaced with matcherUtils in the future.
402 */
403 asymmetricMatch(other: TValue, matchersUtil?: MatchersUtil | ReadonlyArray<CustomEqualityTester>): boolean;
404 jasmineToString?(prettyPrint: typeof pp): string;
405 }
406
407 // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
408 interface ArrayLike<T> {
409 length: number;
410 [n: number]: T;
411 }
412
413 interface ArrayContaining<T> extends AsymmetricMatcher<any> {
414 new?(sample: ArrayLike<T>): ArrayLike<T>;
415 jasmineToString(prettyPrint: typeof pp): string;
416 }
417
418 interface ObjectContaining<T> extends AsymmetricMatcher<T> {
419 new?(sample: { [K in keyof T]?: any }): { [K in keyof T]?: any };
420
421 jasmineToString?(prettyPrint: typeof pp): string;
422 }
423
424 interface Clock {
425 install(): Clock;
426 uninstall(): void;
427 /** 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. */
428 tick(ms: number): void;
429 mockDate(date?: Date): void;
430 withMock(func: () => void): void;
431 }
432
433 type CustomEqualityTester = (first: any, second: any) => boolean | void;
434
435 type CustomObjectFormatter = (value: unknown) => string | undefined;
436
437 interface CustomMatcher {
438 compare<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
439 compare(actual: any, ...expected: any[]): CustomMatcherResult;
440 negativeCompare?<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
441 negativeCompare?(actual: any, ...expected: any[]): CustomMatcherResult;
442 }
443
444 interface CustomAsyncMatcher {
445 compare<T>(actual: T, expected: T, ...args: any[]): PromiseLike<CustomMatcherResult>;
446 compare(actual: any, ...expected: any[]): PromiseLike<CustomMatcherResult>;
447 negativeCompare?<T>(actual: T, expected: T, ...args: any[]): PromiseLike<CustomMatcherResult>;
448 negativeCompare?(actual: any, ...expected: any[]): PromiseLike<CustomMatcherResult>;
449 }
450
451 type CustomMatcherFactory = (
452 util: MatchersUtil,
453 customEqualityTesters: ReadonlyArray<CustomEqualityTester>,
454 ) => CustomMatcher;
455
456 type CustomAsyncMatcherFactory = (
457 util: MatchersUtil,
458 customEqualityTesters: ReadonlyArray<CustomEqualityTester>,
459 ) => CustomAsyncMatcher;
460
461 interface CustomMatcherFactories {
462 [name: string]: CustomMatcherFactory;
463 }
464
465 interface CustomAsyncMatcherFactories {
466 [name: string]: CustomAsyncMatcherFactory;
467 }
468
469 interface CustomMatcherResult {
470 pass: boolean;
471 message?: string | undefined;
472 }
473
474 interface DiffBuilder {
475 setRoots(actual: any, expected: any): void;
476 recordMismatch(formatter?: (actual: any, expected: any, path?: any, prettyPrinter?: any) => string): void;
477 withPath(pathComponent: string, block: () => void): void;
478 getMessage(): string;
479 }
480
481 interface MatchersUtil {
482 equals(a: any, b: any, customTesters?: ReadonlyArray<CustomEqualityTester>, diffBuilder?: DiffBuilder): boolean;
483 contains<T>(
484 haystack: ArrayLike<T> | string,
485 needle: any,
486 customTesters?: ReadonlyArray<CustomEqualityTester>,
487 ): boolean;
488 buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string;
489
490 /**
491 * Formats a value for use in matcher failure messages and similar
492 * contexts, taking into account the current set of custom value
493 * formatters.
494 * @since 3.6.0
495 * @param value The value to pretty-print
496 * @return The pretty-printed value
497 */
498 pp: typeof pp;
499 }
500
501 interface Env {
502 addReporter(reporter: CustomReporter): void;
503 allowRespy(allow: boolean): void;
504 clearReporters(): void;
505 configuration(): Configuration;
506 configure(configuration: Configuration): void;
507 execute(runnablesToRun: Suite[] | null | undefined, onComplete: Func): void;
508 /** @async */
509 execute(runnablesToRun?: Suite[]): PromiseLike<void>;
510 /**
511 * @deprecated Use hideDisabled option in {@link jasmine.Env.configure} instead.
512 */
513 hideDisabled(value: boolean): void;
514 /**
515 * @deprecated Check hideDisabled option in {@link jasmine.Env.configuration} instead.
516 */
517 hidingDisabled(): boolean;
518 provideFallbackReporter(reporter: CustomReporter): void;
519 /**
520 * @deprecated Check random option in {@link jasmine.Env.configuration} instead.
521 */
522 randomTests(): boolean;
523 /**
524 * @deprecated Use random option in {@link jasmine.Env.configure} instead.
525 */
526 randomizeTests(value: boolean): void;
527 /**
528 * @deprecated Use seed option in {@link jasmine.Env.configure} instead.
529 */
530 seed(value?: number | string): number | string;
531 /**
532 * Sets a user-defined property that will be provided to reporters as
533 * part of the properties field of SpecResult.
534 * @since 3.6.0
535 */
536 setSpecProperty: typeof setSpecProperty;
537 /**
538 * Sets a user-defined property that will be provided to reporters as
539 * part of the properties field of SuiteResult.
540 * @since 3.6.0
541 */
542 setSuiteProperty: typeof setSuiteProperty;
543 /**
544 * @deprecated Use specFilter option in {@link jasmine.Env.configure} instead.
545 */
546 specFilter(spec: Spec): boolean;
547 /**
548 * @deprecated Use failFast option in {@link jasmine.Env.configure} instead.
549 */
550 stopOnSpecFailure(value: boolean): void;
551 /**
552 * @deprecated Check failFast option in {@link jasmine.Env.configuration} instead.
553 */
554 stoppingOnSpecFailure(): boolean;
555 /**
556 * @deprecated Use oneFailurePerSpec option in {@link jasmine.Env.configure} instead.
557 */
558 throwOnExpectationFailure(value: boolean): void;
559 /**
560 * @deprecated Check oneFailurePerSpec option in {@link jasmine.Env.configuration} instead.
561 */
562 throwingExpectationFailures(): boolean;
563 topSuite(): Suite;
564 }
565
566 interface HtmlReporter {
567 new (): any;
568 }
569
570 interface HtmlSpecFilter {
571 new (): any;
572 }
573
574 interface Result {
575 type: string;
576 }
577
578 interface ExpectationResult extends Result {
579 matcherName: string;
580 message: string;
581 stack: string;
582 passed: boolean;
583 expected: any;
584 actual: any;
585 }
586
587 interface DeprecationWarning extends Result {
588 message: string;
589 stack: string;
590 }
591
592 interface Order {
593 new (options: { random: boolean; seed: number | string }): any;
594 random: boolean;
595 seed: number | string;
596 sort<T>(items: T[]): T[];
597 }
598
599 namespace errors {
600 class ExpectationFailed extends Error {
601 constructor();
602
603 stack: any;
604 }
605 }
606
607 interface Matchers<T> {
608 /**
609 * Expect the actual value to be `===` to the expected value.
610 *
611 * @param expected The expected value to compare against.
612 * @example
613 * expect(thing).toBe(realThing);
614 */
615 toBe(expected: Expected<T>): void;
616 /**
617 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
618 */
619 // tslint:disable-next-line unified-signatures
620 toBe(expected: Expected<T>, expectationFailOutput: any): void;
621
622 /**
623 * Expect the actual value to be equal to the expected, using deep equality comparison.
624 * @param expected Expected value.
625 * @example
626 * expect(bigObject).toEqual({ "foo": ['bar', 'baz'] });
627 */
628 toEqual(expected: Expected<T>): void;
629 /**
630 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
631 */
632 // tslint:disable-next-line unified-signatures
633 toEqual(expected: Expected<T>, expectationFailOutput: any): void;
634
635 /**
636 * Expect the actual value to match a regular expression.
637 * @param expected Value to look for in the string.
638 * @example
639 * expect("my string").toMatch(/string$/);
640 * expect("other string").toMatch("her");
641 */
642 toMatch(expected: string | RegExp): void;
643 /**
644 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
645 */
646 // tslint:disable-next-line unified-signatures
647 toMatch(expected: string | RegExp, expectationFailOutput: any): void;
648
649 toBeDefined(): void;
650 /**
651 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
652 */
653 // tslint:disable-next-line unified-signatures
654 toBeDefined(expectationFailOutput: any): void;
655 toBeUndefined(): void;
656 /**
657 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
658 */
659 // tslint:disable-next-line unified-signatures
660 toBeUndefined(expectationFailOutput: any): void;
661 toBeNull(): void;
662 /**
663 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
664 */
665 // tslint:disable-next-line unified-signatures
666 toBeNull(expectationFailOutput: any): void;
667 toBeNaN(): void;
668 toBeTruthy(): void;
669 /**
670 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
671 */
672 // tslint:disable-next-line unified-signatures
673 toBeTruthy(expectationFailOutput: any): void;
674 toBeFalsy(): void;
675 /**
676 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
677 */
678 // tslint:disable-next-line unified-signatures
679 toBeFalsy(expectationFailOutput: any): void;
680 toBeTrue(): void;
681 toBeFalse(): void;
682 toHaveBeenCalled(): void;
683 toHaveBeenCalledBefore(expected: Func): void;
684 toHaveBeenCalledWith(...params: any[]): void;
685 toHaveBeenCalledOnceWith(...params: any[]): void;
686 toHaveBeenCalledTimes(expected: number): void;
687 toContain(expected: any): void;
688 /**
689 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
690 */
691 // tslint:disable-next-line unified-signatures
692 toContain(expected: any, expectationFailOutput: any): void;
693 toBeLessThan(expected: number): void;
694 /**
695 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
696 */
697 // tslint:disable-next-line unified-signatures
698 toBeLessThan(expected: number, expectationFailOutput: any): void;
699 toBeLessThanOrEqual(expected: number): void;
700 /**
701 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
702 */
703 // tslint:disable-next-line unified-signatures
704 toBeLessThanOrEqual(expected: number, expectationFailOutput: any): void;
705 toBeGreaterThan(expected: number): void;
706 /**
707 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
708 */
709 // tslint:disable-next-line unified-signatures
710 toBeGreaterThan(expected: number, expectationFailOutput: any): void;
711 toBeGreaterThanOrEqual(expected: number): void;
712 /**
713 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
714 */
715 // tslint:disable-next-line unified-signatures
716 toBeGreaterThanOrEqual(expected: number, expectationFailOutput: any): void;
717 toBeCloseTo(expected: number, precision?: any): void;
718 /**
719 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
720 */
721 // tslint:disable-next-line unified-signatures
722 toBeCloseTo(expected: number, precision: any, expectationFailOutput: any): void;
723 toThrow(expected?: any): void;
724 toThrowError(message?: string | RegExp): void;
725 toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): void;
726 toThrowMatching(predicate: (thrown: any) => boolean): void;
727 toBeNegativeInfinity(): void;
728 /**
729 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
730 */
731 // tslint:disable-next-line unified-signatures
732 toBeNegativeInfinity(expectationFailOutput: any): void;
733 toBePositiveInfinity(): void;
734 /**
735 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
736 */
737 // tslint:disable-next-line unified-signatures
738 toBePositiveInfinity(expectationFailOutput: any): void;
739 toBeInstanceOf(expected: Constructor): void;
740
741 /**
742 * Expect the actual value to be a DOM element that has the expected class.
743 * @since 3.0.0
744 * @param expected The class name to test for.
745 * @example
746 * var el = document.createElement('div');
747 * el.className = 'foo bar baz';
748 * expect(el).toHaveClass('bar');
749 */
750 toHaveClass(expected: string): void;
751 /**
752 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
753 */
754 // tslint:disable-next-line unified-signatures
755 toHaveClass(expected: string, expectationFailOutput: any): void;
756
757 /**
758 * Expect the actual size to be equal to the expected, using array-like
759 * length or object keys size.
760 * @since 3.6.0
761 * @param expected The expected size
762 * @example
763 * array = [1,2];
764 * expect(array).toHaveSize(2);
765 */
766 toHaveSize(expected: number): void;
767
768 /**
769 * Add some context for an expect.
770 * @param message Additional context to show when the matcher fails
771 * @checkReturnValue see https://tsetse.info/check-return-value
772 */
773 withContext(message: string): Matchers<T>;
774
775 /**
776 * Invert the matcher following this expect.
777 */
778 not: Matchers<T>;
779 }
780
781 interface ArrayLikeMatchers<T> extends Matchers<ArrayLike<T>> {
782 /**
783 * Expect the actual value to be `===` to the expected value.
784 *
785 * @param expected The expected value to compare against.
786 * @example
787 * expect(thing).toBe(realThing);
788 */
789 toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>): void;
790 /**
791 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
792 */
793 // tslint:disable-next-line unified-signatures
794 toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput: any): void;
795
796 /**
797 * Expect the actual value to be equal to the expected, using deep equality comparison.
798 * @param expected Expected value.
799 * @example
800 * expect(bigObject).toEqual({ "foo": ['bar', 'baz'] });
801 */
802 toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>): void;
803 /**
804 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
805 */
806 // tslint:disable-next-line unified-signatures
807 toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput: any): void;
808
809 toContain(expected: Expected<T>): void;
810 /**
811 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
812 */
813 // tslint:disable-next-line unified-signatures
814 toContain(expected: Expected<T>, expectationFailOutput: any): void;
815
816 /**
817 * Add some context for an expect.
818 * @param message Additional context to show when the matcher fails.
819 * @checkReturnValue see https://tsetse.info/check-return-value
820 */
821 withContext(message: string): ArrayLikeMatchers<T>;
822
823 /**
824 * Invert the matcher following this expect.
825 */
826 not: ArrayLikeMatchers<T>;
827 }
828
829 type MatchableArgs<Fn> = Fn extends (...args: infer P) => any ? { [K in keyof P]: Expected<P[K]> } : never;
830
831 interface FunctionMatchers<Fn extends Func> extends Matchers<any> {
832 /**
833 * Expects the actual (a spy) to have been called with the particular arguments at least once
834 * @param params The arguments to look for
835 */
836 toHaveBeenCalledWith(...params: MatchableArgs<Fn>): void;
837
838 /**
839 * Expects the actual (a spy) to have been called exactly once, and exactly with the particular arguments
840 * @param params The arguments to look for
841 */
842 toHaveBeenCalledOnceWith(...params: MatchableArgs<Fn>): void;
843
844 /**
845 * Add some context for an expect.
846 * @param message Additional context to show when the matcher fails.
847 * @checkReturnValue see https://tsetse.info/check-return-value
848 */
849 withContext(message: string): FunctionMatchers<Fn>;
850
851 /**
852 * Invert the matcher following this expect.
853 */
854 not: FunctionMatchers<Fn>;
855 }
856
857 interface NothingMatcher {
858 nothing(): void;
859 }
860
861 interface AsyncMatchers<T, U> {
862 /**
863 * Expect a promise to be pending, i.e. the promise is neither resolved nor rejected.
864 */
865 toBePending(): PromiseLike<void>;
866 /**
867 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
868 */
869 // tslint:disable-next-line unified-signatures
870 toBePending(expectationFailOutput: any): PromiseLike<void>;
871
872 /**
873 * Expect a promise to be resolved.
874 */
875 toBeResolved(): PromiseLike<void>;
876 /**
877 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
878 */
879 // tslint:disable-next-line unified-signatures
880 toBeResolved(expectationFailOutput: any): PromiseLike<void>;
881
882 /**
883 * Expect a promise to be rejected.
884 */
885 toBeRejected(): PromiseLike<void>;
886 /**
887 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
888 */
889 // tslint:disable-next-line unified-signatures
890 toBeRejected(expectationFailOutput: any): PromiseLike<void>;
891
892 /**
893 * Expect a promise to be resolved to a value equal to the expected, using deep equality comparison.
894 * @param expected Value that the promise is expected to resolve to.
895 */
896 toBeResolvedTo(expected: Expected<T>): PromiseLike<void>;
897
898 /**
899 * Expect a promise to be rejected with a value equal to the expected, using deep equality comparison.
900 * @param expected Value that the promise is expected to be rejected with.
901 */
902 toBeRejectedWith(expected: Expected<U>): PromiseLike<void>;
903
904 /**
905 * Expect a promise to be rejected with a value matched to the expected.
906 * @param expected Error constructor the object that was thrown needs to be an instance of. If not provided, Error will be used.
907 * @param message The message that should be set on the thrown Error.
908 */
909 toBeRejectedWithError(expected?: new (...args: any[]) => Error, message?: string | RegExp): PromiseLike<void>;
910
911 /**
912 * Expect a promise to be rejected with a value matched to the expected.
913 * @param message The message that should be set on the thrown Error.
914 */
915 toBeRejectedWithError(message?: string | RegExp): PromiseLike<void>;
916
917 /**
918 * Add some context for an expect.
919 * @param message Additional context to show when the matcher fails.
920 * @checkReturnValue see https://tsetse.info/check-return-value
921 */
922 withContext(message: string): AsyncMatchers<T, U>;
923
924 /**
925 * Fail as soon as possible if the actual is pending. Otherwise evaluate the matcher.
926 */
927 already: AsyncMatchers<T, U>;
928
929 /**
930 * Invert the matcher following this expect.
931 */
932 not: AsyncMatchers<T, U>;
933 }
934
935 interface JasmineStartedInfo {
936 totalSpecsDefined: number;
937 order: Order;
938 }
939
940 interface CustomReportExpectation {
941 matcherName: string;
942 message: string;
943 passed: boolean;
944 stack: string;
945 }
946
947 interface FailedExpectation extends CustomReportExpectation {
948 actual: string;
949 expected: string;
950 }
951
952 interface PassedExpectation extends CustomReportExpectation {}
953
954 interface DeprecatedExpectation {
955 message: string;
956 }
957
958 interface SuiteResult {
959 /**
960 * The unique id of this spec.
961 */
962 id: string;
963
964 /**
965 * The description passed to the {@link it} that created this spec.
966 */
967 description: string;
968
969 /**
970 * The full description including all ancestors of this spec.
971 */
972 fullName: string;
973
974 /**
975 * The list of expectations that failed during execution of this spec.
976 */
977 failedExpectations: FailedExpectation[];
978
979 /**
980 * The list of deprecation warnings that occurred during execution this spec.
981 */
982 deprecationWarnings: DeprecatedExpectation[];
983
984 /**
985 * Once the spec has completed, this string represents the pass/fail status of this spec.
986 */
987 status: string;
988
989 /**
990 * The time in ms used by the spec execution, including any before/afterEach.
991 */
992 duration: number | null;
993
994 /**
995 * User-supplied properties, if any, that were set using {@link Env.setSpecProperty}
996 */
997 properties: { [key: string]: unknown } | null;
998 }
999
1000 interface SpecResult extends SuiteResult {
1001 /**
1002 * The list of expectations that passed during execution of this spec.
1003 */
1004 passedExpectations: PassedExpectation[];
1005
1006 /**
1007 * If the spec is pending, this will be the reason.
1008 */
1009 pendingReason: string;
1010 }
1011
1012 interface JasmineDoneInfo {
1013 overallStatus: string;
1014 totalTime: number;
1015 incompleteReason: string;
1016 order: Order;
1017 failedExpectations: ExpectationResult[];
1018 deprecationWarnings: ExpectationResult[];
1019 }
1020
1021 /** @deprecated use JasmineStartedInfo instead */
1022 type SuiteInfo = JasmineStartedInfo;
1023
1024 /** @deprecated use SuiteResult or SpecResult instead */
1025 type CustomReporterResult = SuiteResult & SpecResult;
1026
1027 /** @deprecated use JasmineDoneInfo instead */
1028 type RunDetails = JasmineDoneInfo;
1029
1030 interface CustomReporter {
1031 jasmineStarted?(suiteInfo: JasmineStartedInfo, done?: () => void): void | Promise<void>;
1032 suiteStarted?(result: SuiteResult, done?: () => void): void | Promise<void>;
1033 specStarted?(result: SpecResult, done?: () => void): void | Promise<void>;
1034 specDone?(result: SpecResult, done?: () => void): void | Promise<void>;
1035 suiteDone?(result: SuiteResult, done?: () => void): void | Promise<void>;
1036 jasmineDone?(runDetails: JasmineDoneInfo, done?: () => void): void | Promise<void>;
1037 }
1038
1039 interface SpecFilter {
1040 /**
1041 * A function that takes a spec and returns true if it should be executed or false if it should be skipped.
1042 * @param spec The spec that the filter is being applied to
1043 */
1044 (spec: Spec): boolean;
1045 }
1046
1047 /** @deprecated Please use `SpecFilter` instead of `SpecFunction`. */
1048 type SpecFunction = (spec?: Spec) => void;
1049
1050 interface Spec {
1051 new (attrs: any): any;
1052
1053 readonly id: number;
1054 env: Env;
1055 readonly description: string;
1056 getFullName(): string;
1057 }
1058
1059 interface Suite extends Spec {
1060 parentSuite: Suite;
1061 children: Array<Spec | Suite>;
1062 }
1063
1064 interface Spy<Fn extends Func = Func> {
1065 (...params: Parameters<Fn>): ReturnType<Fn>;
1066
1067 and: SpyAnd<Fn>;
1068 calls: Calls<Fn>;
1069 withArgs(...args: MatchableArgs<Fn>): Spy<Fn>;
1070 }
1071
1072 type SpyObj<T> = T &
1073 {
1074 [K in keyof T]: T[K] extends Func ? T[K] & Spy<T[K]> : T[K];
1075 };
1076
1077 /**
1078 * Determines whether the provided function is a Jasmine spy.
1079 * @since 2.0.0
1080 * @param putativeSpy The function to check.
1081 */
1082 function isSpy(putativeSpy: Func): putativeSpy is Spy;
1083
1084 /**
1085 * It's like SpyObj, but doesn't verify argument/return types for functions.
1086 * Useful if TS cannot correctly infer type for complex objects.
1087 */
1088 type NonTypedSpyObj<T> = SpyObj<{ [K in keyof T]: T[K] extends Func ? Func : T[K] }>;
1089
1090 /**
1091 * Obtains the promised type that a promise-returning function resolves to.
1092 */
1093 type PromisedReturnType<Fn extends Func> = Fn extends (...args: any[]) => PromiseLike<infer TResult>
1094 ? TResult
1095 : never;
1096
1097 /**
1098 * Obtains the type that a promise-returning function can be rejected with.
1099 * This is so we can use .and.rejectWith() only for functions that return a promise.
1100 */
1101 type PromisedRejectType<Fn extends Function> = Fn extends (...args: any[]) => PromiseLike<unknown> ? any : never;
1102
1103 interface SpyAnd<Fn extends Func> {
1104 identity: string;
1105
1106 /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
1107 callThrough(): Spy<Fn>;
1108 /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
1109 returnValue(val: ReturnType<Fn>): Spy<Fn>;
1110 /** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */
1111 returnValues(...values: Array<ReturnType<Fn>>): Spy<Fn>;
1112 /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
1113 callFake(fn: Fn): Spy<Fn>;
1114 /** Tell the spy to return a promise resolving to the specified value when invoked. */
1115 resolveTo(val?: PromisedReturnType<Fn>): Spy<Fn>;
1116 /** Tell the spy to return a promise rejecting with the specified value when invoked. */
1117 rejectWith(val?: PromisedRejectType<Fn>): Spy<Fn>;
1118 /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
1119 throwError(msg: string | Error): Spy;
1120 /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
1121 stub(): Spy;
1122 }
1123
1124 interface Calls<Fn extends Func> {
1125 /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. */
1126 any(): boolean;
1127 /** By chaining the spy with calls.count(), will return the number of times the spy was called */
1128 count(): number;
1129 /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index */
1130 argsFor(index: number): Parameters<Fn>;
1131 /** By chaining the spy with calls.allArgs(), will return the arguments to all calls */
1132 allArgs(): ReadonlyArray<Parameters<Fn>>;
1133 /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls */
1134 all(): ReadonlyArray<CallInfo<Fn>>;
1135 /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call */
1136 mostRecent(): CallInfo<Fn>;
1137 /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call */
1138 first(): CallInfo<Fn>;
1139 /** By chaining the spy with calls.reset(), will clears all tracking for a spy */
1140 reset(): void;
1141 /** Set this spy to do a shallow clone of arguments passed to each invocation. */
1142 saveArgumentsByValue(): void;
1143 /** Get the "this" object that was passed to a specific invocation of this spy. */
1144 thisFor(index: number): any;
1145 }
1146
1147 interface CallInfo<Fn extends Func> {
1148 /** The context (the this) for the call */
1149 object: any;
1150 /** All arguments passed to the call */
1151 args: Parameters<Fn>;
1152 /** The return value of the call */
1153 returnValue: ReturnType<Fn>;
1154 }
1155
1156 interface Util {
1157 inherit(childClass: Function, parentClass: Function): any;
1158 formatException(e: any): any;
1159 htmlEscape(str: string): string;
1160 argsToArray(args: any): any;
1161 extend(destination: any, source: any): any;
1162 }
1163
1164 interface JsApiReporter extends CustomReporter {
1165 new (): any;
1166
1167 started: boolean;
1168 finished: boolean;
1169 runDetails: JasmineDoneInfo;
1170
1171 status(): string;
1172 suiteResults(index: number, length: number): SuiteResult[];
1173 specResults(index: number, length: number): SpecResult[];
1174 suites(): { [id: string]: SuiteResult };
1175 specs(): SpecResult[];
1176 executionTime(): number;
1177 }
1178
1179 interface Jasmine {
1180 Spec: Spec;
1181 clock: Clock;
1182 util: Util;
1183 }
1184
1185 var HtmlReporter: HtmlReporter;
1186 var HtmlSpecFilter: HtmlSpecFilter;
1187
1188 /**
1189 * Default number of milliseconds Jasmine will wait for an asynchronous spec to complete.
1190 */
1191 var DEFAULT_TIMEOUT_INTERVAL: number;
1192
1193 /**
1194 * Maximum number of array elements to display when pretty printing objects.
1195 * This will also limit the number of keys and values displayed for an object.
1196 * Elements past this number will be ellipised.
1197 */
1198 var MAX_PRETTY_PRINT_ARRAY_LENGTH: number;
1199
1200 /**
1201 * Maximum number of characters to display when pretty printing objects.
1202 * Characters past this number will be ellipised.
1203 */
1204 var MAX_PRETTY_PRINT_CHARS: number;
1205
1206 /**
1207 * Maximum object depth the pretty printer will print to.
1208 * Set this to a lower value to speed up pretty printing if you have large objects.
1209 */
1210 var MAX_PRETTY_PRINT_DEPTH: number;
1211
1212 var version: string;
1213
1214 interface JasmineOptions {
1215 /**
1216 * The path to the project's base directory. This can be absolute or relative
1217 * to the current working directory. If it isn't specified, the current working
1218 * directory will be used.
1219 */
1220 projectBaseDir?: string;
1221 }
1222
1223 interface JasmineConfig {
1224 /**
1225 * Whether to fail specs that contain no expectations.
1226 * @default false
1227 */
1228 failSpecWithNoExpectations?: boolean;
1229 /**
1230 * An array of helper file paths or globs that match helper files. Each path or
1231 * glob will be evaluated relative to the spec directory. Helpers are loaded before specs.
1232 */
1233 helpers?: string[];
1234 /**
1235 * Specifies how to load files with names ending in .js. Valid values are
1236 * "require" and "import". "import" should be safe in all cases, and is
1237 * required if your project contains ES modules with filenames ending in .js.
1238 * @default "require"
1239 */
1240 jsLoader?: "require" | "import";
1241 /**
1242 * Whether to run specs in a random order.
1243 */
1244 random?: boolean;
1245 /**
1246 * An array of module names to load via require() at the start of execution.
1247 */
1248 requires?: string[];
1249 /**
1250 * The directory that spec files are contained in, relative to the project base directory.
1251 */
1252 spec_dir?: string;
1253 /**
1254 * An array of spec file paths or globs that match helper files. Each path
1255 * or glob will be evaluated relative to the spec directory.
1256 */
1257 spec_files?: string[];
1258 /**
1259 * Whether to stop suite execution on the first spec failure.
1260 */
1261 stopOnSpecFailure?: boolean;
1262 /**
1263 * Whether to stop each spec on the first expectation failure.
1264 */
1265 stopSpecOnExpectationFailure?: boolean;
1266 }
1267
1268 interface DefaultReporterOptions {
1269 timer?: any;
1270 print?: (...args: any[]) => void;
1271 showColors?: boolean;
1272 jasmineCorePath?: string;
1273 }
1274}
1275
1276declare module "jasmine" {
1277 class jasmine {
1278 jasmine: jasmine.Jasmine;
1279 env: jasmine.Env;
1280 reportersCount: number;
1281 completionReporter: jasmine.CustomReporter;
1282 reporter: jasmine.CustomReporter;
1283 showingColors: boolean;
1284 projectBaseDir: string;
1285 specDir: string;
1286 specFiles: string[];
1287 helperFiles: string[];
1288 requires: string[];
1289 onCompleteCallbackAdded: boolean;
1290 defaultReporterConfigured: boolean;
1291
1292 constructor(options: jasmine.JasmineOptions);
1293 addMatchers(matchers: jasmine.CustomMatcherFactories): void;
1294 /**
1295 * Add a custom reporter to the Jasmine environment.
1296 */
1297 addReporter(reporter: jasmine.CustomReporter): void;
1298 /**
1299 * Adds a spec file to the list that will be loaded when the suite is executed.
1300 */
1301 addSpecFile(filePath: string): void;
1302 addSpecFiles(files: string[]): void;
1303 addHelperFiles(files: string[]): void;
1304 addRequires(files: string[]): void;
1305 /**
1306 * Configure the default reporter.
1307 */
1308 configureDefaultReporter(options: jasmine.DefaultReporterOptions): void;
1309 execute(files?: string[], filterString?: string): Promise<void>;
1310 exitCodeCompletion(passed: boolean): void;
1311 loadConfig(config: jasmine.JasmineConfig): void;
1312 loadConfigFile(configFilePath?: string): void;
1313 loadHelpers(): Promise<void>;
1314 loadSpecs(): Promise<void>;
1315 loadRequires(): void;
1316 onComplete(onCompleteCallback: (passed: boolean) => void): void;
1317 /**
1318 * Provide a fallback reporter if no other reporters have been specified.
1319 */
1320 provideFallbackReporter(reporter: jasmine.CustomReporter): void;
1321 /**
1322 * Clears all registered reporters.
1323 */
1324 clearReporters(): void;
1325 /**
1326 * Sets whether to randomize the order of specs.
1327 */
1328 randomizeTests(value: boolean): void;
1329 /**
1330 * Sets the random seed.
1331 */
1332 seed(value: number): void;
1333 /**
1334 * Sets whether to show colors in the console reporter.
1335 */
1336 showColors(value: boolean): void;
1337 stopSpecOnExpectationFailure(value: boolean): void;
1338 stopOnSpecFailure(value: boolean): void;
1339 static ConsoleReporter(): any;
1340
1341 /**
1342 * The version of jasmine-core in use
1343 */
1344 coreVersion(): string;
1345 }
1346 export = jasmine;
1347}