UNPKG

54.2 kBTypeScriptView Raw
1// Type definitions for Jasmine 3.10
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 * Clean closures when a suite is done running (done by clearing the stored function reference).
310 * This prevents memory leaks, but you won't be able to run jasmine multiple times.
311 * @since 3.10.0
312 * @default true
313 */
314 autoCleanClosures?: boolean | undefined;
315 }
316
317 /** @deprecated Please use `Configuration` instead of `EnvConfiguration`. */
318 type EnvConfiguration = Configuration;
319
320 function clock(): Clock;
321 function DiffBuilder(): DiffBuilder;
322
323 var matchersUtil: MatchersUtil;
324
325 /**
326 * That will succeed if the actual value being compared is an instance of the specified class/constructor.
327 */
328 function any(aclass: Constructor | Symbol): AsymmetricMatcher<any>;
329
330 /**
331 * That will succeed if the actual value being compared is not `null` and not `undefined`.
332 */
333 function anything(): AsymmetricMatcher<any>;
334
335 /**
336 * That will succeed if the actual value being compared is `true` or anything truthy.
337 * @since 3.1.0
338 */
339 function truthy(): AsymmetricMatcher<any>;
340
341 /**
342 * That will succeed if the actual value being compared is `null`, `undefined`, `0`, `false` or anything falsey.
343 * @since 3.1.0
344 */
345 function falsy(): AsymmetricMatcher<any>;
346
347 /**
348 * That will succeed if the actual value being compared is empty.
349 * @since 3.1.0
350 */
351 function empty(): AsymmetricMatcher<any>;
352
353 /**
354 * That will succeed if the actual value being compared is not empty.
355 * @since 3.1.0
356 */
357 function notEmpty(): AsymmetricMatcher<any>;
358
359 function arrayContaining<T>(sample: ArrayLike<T>): ArrayContaining<T>;
360 function arrayWithExactContents<T>(sample: ArrayLike<T>): ArrayContaining<T>;
361 function objectContaining<T>(sample: { [K in keyof T]?: ExpectedRecursive<T[K]> }): ObjectContaining<T>;
362 function mapContaining<K, V>(sample: Map<K, V>): AsymmetricMatcher<Map<K, V>>;
363 function setContaining<T>(sample: Set<T>): AsymmetricMatcher<Set<T>>;
364
365 function setDefaultSpyStrategy<Fn extends Func = Func>(fn?: (and: SpyAnd<Fn>) => void): void;
366 function addSpyStrategy<Fn extends Func = Func>(name: string, factory: Fn): void;
367 function createSpy<Fn extends Func>(name?: string, originalFn?: Fn): Spy<Fn>;
368 function createSpyObj(baseName: string, methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any;
369 function createSpyObj<T>(
370 baseName: string,
371 methodNames: SpyObjMethodNames<T>,
372 propertyNames?: SpyObjPropertyNames<T>,
373 ): SpyObj<T>;
374 function createSpyObj(methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any;
375 function createSpyObj<T>(methodNames: SpyObjMethodNames<T>, propertyNames?: SpyObjPropertyNames<T>): SpyObj<T>;
376
377 function pp(value: any): string;
378
379 function getEnv(): Env;
380
381 function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
382
383 /**
384 * Add a custom object formatter for the current scope of specs.
385 * Note: This is only callable from within a beforeEach, it, or beforeAll.
386 * @since 3.6.0
387 * @see https://jasmine.github.io/tutorials/custom_object_formatters
388 */
389 function addCustomObjectFormatter(formatter: CustomObjectFormatter): void;
390
391 function addMatchers(matchers: CustomMatcherFactories): void;
392 function addAsyncMatchers(matchers: CustomAsyncMatcherFactories): void;
393
394 function stringMatching(str: string | RegExp): AsymmetricMatcher<string>;
395
396 function stringContaining(str: string | RegExp): AsymmetricMatcher<string>;
397 /**
398 * @deprecated Private method that may be changed or removed in the future
399 */
400 function formatErrorMsg(domain: string, usage: string): (msg: string) => string;
401
402 interface Any extends AsymmetricMatcher<any> {
403 new (expectedClass: any): any;
404 jasmineToString(prettyPrint: typeof pp): string;
405 }
406
407 interface AsymmetricMatcher<TValue> {
408 /**
409 * customTesters are deprecated and will be replaced with matcherUtils in the future.
410 */
411 asymmetricMatch(other: TValue, matchersUtil?: MatchersUtil | ReadonlyArray<CustomEqualityTester>): boolean;
412 jasmineToString?(prettyPrint: typeof pp): string;
413 }
414
415 // taken from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
416 interface ArrayLike<T> {
417 length: number;
418 [n: number]: T;
419 }
420
421 interface ArrayContaining<T> extends AsymmetricMatcher<any> {
422 new?(sample: ArrayLike<T>): ArrayLike<T>;
423 jasmineToString(prettyPrint: typeof pp): string;
424 }
425
426 interface ObjectContaining<T> extends AsymmetricMatcher<T> {
427 new?(sample: { [K in keyof T]?: any }): { [K in keyof T]?: any };
428
429 jasmineToString?(prettyPrint: typeof pp): string;
430 }
431
432 interface Clock {
433 install(): Clock;
434 uninstall(): void;
435 /** 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. */
436 tick(ms: number): void;
437 mockDate(date?: Date): void;
438 withMock(func: () => void): void;
439 }
440
441 type CustomEqualityTester = (first: any, second: any) => boolean | void;
442
443 type CustomObjectFormatter = (value: unknown) => string | undefined;
444
445 interface CustomMatcher {
446 compare<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
447 compare(actual: any, ...expected: any[]): CustomMatcherResult;
448 negativeCompare?<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
449 negativeCompare?(actual: any, ...expected: any[]): CustomMatcherResult;
450 }
451
452 interface CustomAsyncMatcher {
453 compare<T>(actual: T, expected: T, ...args: any[]): PromiseLike<CustomMatcherResult>;
454 compare(actual: any, ...expected: any[]): PromiseLike<CustomMatcherResult>;
455 negativeCompare?<T>(actual: T, expected: T, ...args: any[]): PromiseLike<CustomMatcherResult>;
456 negativeCompare?(actual: any, ...expected: any[]): PromiseLike<CustomMatcherResult>;
457 }
458
459 type CustomMatcherFactory = (
460 util: MatchersUtil,
461 customEqualityTesters: ReadonlyArray<CustomEqualityTester>,
462 ) => CustomMatcher;
463
464 type CustomAsyncMatcherFactory = (
465 util: MatchersUtil,
466 customEqualityTesters: ReadonlyArray<CustomEqualityTester>,
467 ) => CustomAsyncMatcher;
468
469 interface CustomMatcherFactories {
470 [name: string]: CustomMatcherFactory;
471 }
472
473 interface CustomAsyncMatcherFactories {
474 [name: string]: CustomAsyncMatcherFactory;
475 }
476
477 interface CustomMatcherResult {
478 pass: boolean;
479 message?: string | undefined;
480 }
481
482 interface DiffBuilder {
483 setRoots(actual: any, expected: any): void;
484 recordMismatch(formatter?: (actual: any, expected: any, path?: any, prettyPrinter?: any) => string): void;
485 withPath(pathComponent: string, block: () => void): void;
486 getMessage(): string;
487 }
488
489 interface MatchersUtil {
490 equals(a: any, b: any, customTesters?: ReadonlyArray<CustomEqualityTester>, diffBuilder?: DiffBuilder): boolean;
491 contains<T>(
492 haystack: ArrayLike<T> | string,
493 needle: any,
494 customTesters?: ReadonlyArray<CustomEqualityTester>,
495 ): boolean;
496 buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string;
497
498 /**
499 * Formats a value for use in matcher failure messages and similar
500 * contexts, taking into account the current set of custom value
501 * formatters.
502 * @since 3.6.0
503 * @param value The value to pretty-print
504 * @return The pretty-printed value
505 */
506 pp: typeof pp;
507 }
508
509 interface Env {
510 addReporter(reporter: CustomReporter): void;
511 allowRespy(allow: boolean): void;
512 clearReporters(): void;
513 configuration(): Configuration;
514 configure(configuration: Configuration): void;
515 execute(runnablesToRun: Suite[] | null | undefined, onComplete: Func): void;
516 /** @async */
517 execute(runnablesToRun?: Suite[]): PromiseLike<void>;
518 /**
519 * @deprecated Use hideDisabled option in {@link jasmine.Env.configure} instead.
520 */
521 hideDisabled(value: boolean): void;
522 /**
523 * @deprecated Check hideDisabled option in {@link jasmine.Env.configuration} instead.
524 */
525 hidingDisabled(): boolean;
526 provideFallbackReporter(reporter: CustomReporter): void;
527 /**
528 * @deprecated Check random option in {@link jasmine.Env.configuration} instead.
529 */
530 randomTests(): boolean;
531 /**
532 * @deprecated Use random option in {@link jasmine.Env.configure} instead.
533 */
534 randomizeTests(value: boolean): void;
535 /**
536 * @deprecated Use seed option in {@link jasmine.Env.configure} instead.
537 */
538 seed(value?: number | string): number | string;
539 /**
540 * Sets a user-defined property that will be provided to reporters as
541 * part of the properties field of SpecResult.
542 * @since 3.6.0
543 */
544 setSpecProperty: typeof setSpecProperty;
545 /**
546 * Sets a user-defined property that will be provided to reporters as
547 * part of the properties field of SuiteResult.
548 * @since 3.6.0
549 */
550 setSuiteProperty: typeof setSuiteProperty;
551 /**
552 * @deprecated Use specFilter option in {@link jasmine.Env.configure} instead.
553 */
554 specFilter(spec: Spec): boolean;
555 /**
556 * @deprecated Use failFast option in {@link jasmine.Env.configure} instead.
557 */
558 stopOnSpecFailure(value: boolean): void;
559 /**
560 * @deprecated Check failFast option in {@link jasmine.Env.configuration} instead.
561 */
562 stoppingOnSpecFailure(): boolean;
563 /**
564 * @deprecated Use oneFailurePerSpec option in {@link jasmine.Env.configure} instead.
565 */
566 throwOnExpectationFailure(value: boolean): void;
567 /**
568 * @deprecated Check oneFailurePerSpec option in {@link jasmine.Env.configuration} instead.
569 */
570 throwingExpectationFailures(): boolean;
571 topSuite(): Suite;
572 }
573
574 interface HtmlReporter {
575 new (): any;
576 }
577
578 interface HtmlSpecFilter {
579 new (): any;
580 }
581
582 interface Result {
583 type: string;
584 }
585
586 interface ExpectationResult extends Result {
587 matcherName: string;
588 message: string;
589 stack: string;
590 passed: boolean;
591 expected: any;
592 actual: any;
593 }
594
595 interface DeprecationWarning extends Result {
596 message: string;
597 stack: string;
598 }
599
600 interface Order {
601 new (options: { random: boolean; seed: number | string }): any;
602 random: boolean;
603 seed: number | string;
604 sort<T>(items: T[]): T[];
605 }
606
607 namespace errors {
608 class ExpectationFailed extends Error {
609 constructor();
610
611 stack: any;
612 }
613 }
614
615 interface Matchers<T> {
616 /**
617 * Expect the actual value to be `===` to the expected value.
618 *
619 * @param expected The expected value to compare against.
620 * @example
621 * expect(thing).toBe(realThing);
622 */
623 toBe(expected: Expected<T>): void;
624 /**
625 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
626 */
627 // tslint:disable-next-line unified-signatures
628 toBe(expected: Expected<T>, expectationFailOutput: any): void;
629
630 /**
631 * Expect the actual value to be equal to the expected, using deep equality comparison.
632 * @param expected Expected value.
633 * @example
634 * expect(bigObject).toEqual({ "foo": ['bar', 'baz'] });
635 */
636 toEqual(expected: Expected<T>): void;
637 /**
638 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
639 */
640 // tslint:disable-next-line unified-signatures
641 toEqual(expected: Expected<T>, expectationFailOutput: any): void;
642
643 /**
644 * Expect the actual value to match a regular expression.
645 * @param expected Value to look for in the string.
646 * @example
647 * expect("my string").toMatch(/string$/);
648 * expect("other string").toMatch("her");
649 */
650 toMatch(expected: string | RegExp): void;
651 /**
652 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
653 */
654 // tslint:disable-next-line unified-signatures
655 toMatch(expected: string | RegExp, expectationFailOutput: any): void;
656
657 toBeDefined(): void;
658 /**
659 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
660 */
661 // tslint:disable-next-line unified-signatures
662 toBeDefined(expectationFailOutput: any): void;
663 toBeUndefined(): void;
664 /**
665 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
666 */
667 // tslint:disable-next-line unified-signatures
668 toBeUndefined(expectationFailOutput: any): void;
669 toBeNull(): void;
670 /**
671 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
672 */
673 // tslint:disable-next-line unified-signatures
674 toBeNull(expectationFailOutput: any): void;
675 toBeNaN(): void;
676 toBeTruthy(): void;
677 /**
678 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
679 */
680 // tslint:disable-next-line unified-signatures
681 toBeTruthy(expectationFailOutput: any): void;
682 toBeFalsy(): void;
683 /**
684 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
685 */
686 // tslint:disable-next-line unified-signatures
687 toBeFalsy(expectationFailOutput: any): void;
688 toBeTrue(): void;
689 toBeFalse(): void;
690 toHaveBeenCalled(): void;
691 toHaveBeenCalledBefore(expected: Func): void;
692 toHaveBeenCalledWith(...params: any[]): void;
693 toHaveBeenCalledOnceWith(...params: any[]): void;
694 toHaveBeenCalledTimes(expected: number): void;
695 toContain(expected: any): void;
696 /**
697 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
698 */
699 // tslint:disable-next-line unified-signatures
700 toContain(expected: any, expectationFailOutput: any): void;
701 toBeLessThan(expected: number): void;
702 /**
703 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
704 */
705 // tslint:disable-next-line unified-signatures
706 toBeLessThan(expected: number, expectationFailOutput: any): void;
707 toBeLessThanOrEqual(expected: number): void;
708 /**
709 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
710 */
711 // tslint:disable-next-line unified-signatures
712 toBeLessThanOrEqual(expected: number, expectationFailOutput: any): void;
713 toBeGreaterThan(expected: number): void;
714 /**
715 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
716 */
717 // tslint:disable-next-line unified-signatures
718 toBeGreaterThan(expected: number, expectationFailOutput: any): void;
719 toBeGreaterThanOrEqual(expected: number): void;
720 /**
721 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
722 */
723 // tslint:disable-next-line unified-signatures
724 toBeGreaterThanOrEqual(expected: number, expectationFailOutput: any): void;
725 toBeCloseTo(expected: number, precision?: any): void;
726 /**
727 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
728 */
729 // tslint:disable-next-line unified-signatures
730 toBeCloseTo(expected: number, precision: any, expectationFailOutput: any): void;
731 toThrow(expected?: any): void;
732 toThrowError(message?: string | RegExp): void;
733 toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): void;
734 toThrowMatching(predicate: (thrown: any) => boolean): void;
735 toBeNegativeInfinity(): void;
736 /**
737 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
738 */
739 // tslint:disable-next-line unified-signatures
740 toBeNegativeInfinity(expectationFailOutput: any): void;
741 toBePositiveInfinity(): void;
742 /**
743 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
744 */
745 // tslint:disable-next-line unified-signatures
746 toBePositiveInfinity(expectationFailOutput: any): void;
747 toBeInstanceOf(expected: Constructor): void;
748
749 /**
750 * Expect the actual value to be a DOM element that has the expected class.
751 * @since 3.0.0
752 * @param expected The class name to test for.
753 * @example
754 * var el = document.createElement('div');
755 * el.className = 'foo bar baz';
756 * expect(el).toHaveClass('bar');
757 */
758 toHaveClass(expected: string): void;
759 /**
760 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
761 */
762 // tslint:disable-next-line unified-signatures
763 toHaveClass(expected: string, expectationFailOutput: any): void;
764
765 /**
766 * Expect the actual size to be equal to the expected, using array-like
767 * length or object keys size.
768 * @since 3.6.0
769 * @param expected The expected size
770 * @example
771 * array = [1,2];
772 * expect(array).toHaveSize(2);
773 */
774 toHaveSize(expected: number): void;
775
776 /**
777 * Add some context for an expect.
778 * @param message Additional context to show when the matcher fails
779 * @checkReturnValue see https://tsetse.info/check-return-value
780 */
781 withContext(message: string): Matchers<T>;
782
783 /**
784 * Invert the matcher following this expect.
785 */
786 not: Matchers<T>;
787 }
788
789 interface ArrayLikeMatchers<T> extends Matchers<ArrayLike<T>> {
790 /**
791 * Expect the actual value to be `===` to the expected value.
792 *
793 * @param expected The expected value to compare against.
794 * @example
795 * expect(thing).toBe(realThing);
796 */
797 toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>): void;
798 /**
799 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
800 */
801 // tslint:disable-next-line unified-signatures
802 toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput: any): void;
803
804 /**
805 * Expect the actual value to be equal to the expected, using deep equality comparison.
806 * @param expected Expected value.
807 * @example
808 * expect(bigObject).toEqual({ "foo": ['bar', 'baz'] });
809 */
810 toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>): void;
811 /**
812 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
813 */
814 // tslint:disable-next-line unified-signatures
815 toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput: any): void;
816
817 toContain(expected: Expected<T>): void;
818 /**
819 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
820 */
821 // tslint:disable-next-line unified-signatures
822 toContain(expected: Expected<T>, expectationFailOutput: any): void;
823
824 /**
825 * Add some context for an expect.
826 * @param message Additional context to show when the matcher fails.
827 * @checkReturnValue see https://tsetse.info/check-return-value
828 */
829 withContext(message: string): ArrayLikeMatchers<T>;
830
831 /**
832 * Invert the matcher following this expect.
833 */
834 not: ArrayLikeMatchers<T>;
835 }
836
837 type MatchableArgs<Fn> = Fn extends (...args: infer P) => any ? { [K in keyof P]: Expected<P[K]> } : never;
838
839 interface FunctionMatchers<Fn extends Func> extends Matchers<any> {
840 /**
841 * Expects the actual (a spy) to have been called with the particular arguments at least once
842 * @param params The arguments to look for
843 */
844 toHaveBeenCalledWith(...params: MatchableArgs<Fn>): void;
845
846 /**
847 * Expects the actual (a spy) to have been called exactly once, and exactly with the particular arguments
848 * @param params The arguments to look for
849 */
850 toHaveBeenCalledOnceWith(...params: MatchableArgs<Fn>): void;
851
852 /**
853 * Add some context for an expect.
854 * @param message Additional context to show when the matcher fails.
855 * @checkReturnValue see https://tsetse.info/check-return-value
856 */
857 withContext(message: string): FunctionMatchers<Fn>;
858
859 /**
860 * Invert the matcher following this expect.
861 */
862 not: FunctionMatchers<Fn>;
863 }
864
865 interface NothingMatcher {
866 nothing(): void;
867 }
868
869 interface AsyncMatchers<T, U> {
870 /**
871 * Expect a promise to be pending, i.e. the promise is neither resolved nor rejected.
872 */
873 toBePending(): PromiseLike<void>;
874 /**
875 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
876 */
877 // tslint:disable-next-line unified-signatures
878 toBePending(expectationFailOutput: any): PromiseLike<void>;
879
880 /**
881 * Expect a promise to be resolved.
882 */
883 toBeResolved(): PromiseLike<void>;
884 /**
885 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
886 */
887 // tslint:disable-next-line unified-signatures
888 toBeResolved(expectationFailOutput: any): PromiseLike<void>;
889
890 /**
891 * Expect a promise to be rejected.
892 */
893 toBeRejected(): PromiseLike<void>;
894 /**
895 * @deprecated expectationFailOutput is deprecated. Use withContext instead.
896 */
897 // tslint:disable-next-line unified-signatures
898 toBeRejected(expectationFailOutput: any): PromiseLike<void>;
899
900 /**
901 * Expect a promise to be resolved to a value equal to the expected, using deep equality comparison.
902 * @param expected Value that the promise is expected to resolve to.
903 */
904 toBeResolvedTo(expected: Expected<T>): PromiseLike<void>;
905
906 /**
907 * Expect a promise to be rejected with a value equal to the expected, using deep equality comparison.
908 * @param expected Value that the promise is expected to be rejected with.
909 */
910 toBeRejectedWith(expected: Expected<U>): PromiseLike<void>;
911
912 /**
913 * Expect a promise to be rejected with a value matched to the expected.
914 * @param expected Error constructor the object that was thrown needs to be an instance of. If not provided, Error will be used.
915 * @param message The message that should be set on the thrown Error.
916 */
917 toBeRejectedWithError(expected?: new (...args: any[]) => Error, message?: string | RegExp): PromiseLike<void>;
918
919 /**
920 * Expect a promise to be rejected with a value matched to the expected.
921 * @param message The message that should be set on the thrown Error.
922 */
923 toBeRejectedWithError(message?: string | RegExp): PromiseLike<void>;
924
925 /**
926 * Add some context for an expect.
927 * @param message Additional context to show when the matcher fails.
928 * @checkReturnValue see https://tsetse.info/check-return-value
929 */
930 withContext(message: string): AsyncMatchers<T, U>;
931
932 /**
933 * Fail as soon as possible if the actual is pending. Otherwise evaluate the matcher.
934 */
935 already: AsyncMatchers<T, U>;
936
937 /**
938 * Invert the matcher following this expect.
939 */
940 not: AsyncMatchers<T, U>;
941 }
942
943 interface JasmineStartedInfo {
944 totalSpecsDefined: number;
945 order: Order;
946 }
947
948 interface CustomReportExpectation {
949 matcherName: string;
950 message: string;
951 passed: boolean;
952 stack: string;
953 }
954
955 interface FailedExpectation extends CustomReportExpectation {
956 actual: string;
957 expected: string;
958 }
959
960 interface PassedExpectation extends CustomReportExpectation {}
961
962 interface DeprecatedExpectation {
963 message: string;
964 }
965
966 interface SuiteResult {
967 /**
968 * The unique id of this spec.
969 */
970 id: string;
971
972 /**
973 * The description passed to the {@link it} that created this spec.
974 */
975 description: string;
976
977 /**
978 * The full description including all ancestors of this spec.
979 */
980 fullName: string;
981
982 /**
983 * The list of expectations that failed during execution of this spec.
984 */
985 failedExpectations: FailedExpectation[];
986
987 /**
988 * The list of deprecation warnings that occurred during execution this spec.
989 */
990 deprecationWarnings: DeprecatedExpectation[];
991
992 /**
993 * Once the spec has completed, this string represents the pass/fail status of this spec.
994 */
995 status: string;
996
997 /**
998 * The time in ms used by the spec execution, including any before/afterEach.
999 */
1000 duration: number | null;
1001
1002 /**
1003 * User-supplied properties, if any, that were set using {@link Env.setSpecProperty}
1004 */
1005 properties: { [key: string]: unknown } | null;
1006 }
1007
1008 interface SpecResult extends SuiteResult {
1009 /**
1010 * The list of expectations that passed during execution of this spec.
1011 */
1012 passedExpectations: PassedExpectation[];
1013
1014 /**
1015 * If the spec is pending, this will be the reason.
1016 */
1017 pendingReason: string;
1018 }
1019
1020 interface JasmineDoneInfo {
1021 overallStatus: string;
1022 totalTime: number;
1023 incompleteReason: string;
1024 order: Order;
1025 failedExpectations: ExpectationResult[];
1026 deprecationWarnings: ExpectationResult[];
1027 }
1028
1029 /** @deprecated use JasmineStartedInfo instead */
1030 type SuiteInfo = JasmineStartedInfo;
1031
1032 /** @deprecated use SuiteResult or SpecResult instead */
1033 type CustomReporterResult = SuiteResult & SpecResult;
1034
1035 /** @deprecated use JasmineDoneInfo instead */
1036 type RunDetails = JasmineDoneInfo;
1037
1038 interface CustomReporter {
1039 jasmineStarted?(suiteInfo: JasmineStartedInfo, done?: () => void): void | Promise<void>;
1040 suiteStarted?(result: SuiteResult, done?: () => void): void | Promise<void>;
1041 specStarted?(result: SpecResult, done?: () => void): void | Promise<void>;
1042 specDone?(result: SpecResult, done?: () => void): void | Promise<void>;
1043 suiteDone?(result: SuiteResult, done?: () => void): void | Promise<void>;
1044 jasmineDone?(runDetails: JasmineDoneInfo, done?: () => void): void | Promise<void>;
1045 }
1046
1047 interface SpecFilter {
1048 /**
1049 * A function that takes a spec and returns true if it should be executed or false if it should be skipped.
1050 * @param spec The spec that the filter is being applied to
1051 */
1052 (spec: Spec): boolean;
1053 }
1054
1055 /** @deprecated Please use `SpecFilter` instead of `SpecFunction`. */
1056 type SpecFunction = (spec?: Spec) => void;
1057
1058 interface Spec {
1059 new (attrs: any): any;
1060
1061 readonly id: number;
1062 env: Env;
1063 readonly description: string;
1064 getFullName(): string;
1065 }
1066
1067 interface Suite extends Spec {
1068 parentSuite: Suite;
1069 children: Array<Spec | Suite>;
1070 }
1071
1072 interface Spy<Fn extends Func = Func> {
1073 (...params: Parameters<Fn>): ReturnType<Fn>;
1074
1075 and: SpyAnd<Fn>;
1076 calls: Calls<Fn>;
1077 withArgs(...args: MatchableArgs<Fn>): Spy<Fn>;
1078 }
1079
1080 type SpyObj<T> = T &
1081 {
1082 [K in keyof T]: T[K] extends Func ? T[K] & Spy<T[K]> : T[K];
1083 };
1084
1085 /**
1086 * Determines whether the provided function is a Jasmine spy.
1087 * @since 2.0.0
1088 * @param putativeSpy The function to check.
1089 */
1090 function isSpy(putativeSpy: Func): putativeSpy is Spy;
1091
1092 /**
1093 * It's like SpyObj, but doesn't verify argument/return types for functions.
1094 * Useful if TS cannot correctly infer type for complex objects.
1095 */
1096 type NonTypedSpyObj<T> = SpyObj<{ [K in keyof T]: T[K] extends Func ? Func : T[K] }>;
1097
1098 /**
1099 * Obtains the promised type that a promise-returning function resolves to.
1100 */
1101 type PromisedReturnType<Fn extends Func> = Fn extends (...args: any[]) => PromiseLike<infer TResult>
1102 ? TResult
1103 : never;
1104
1105 /**
1106 * Obtains the type that a promise-returning function can be rejected with.
1107 * This is so we can use .and.rejectWith() only for functions that return a promise.
1108 */
1109 type PromisedRejectType<Fn extends Function> = Fn extends (...args: any[]) => PromiseLike<unknown> ? any : never;
1110
1111 interface SpyAnd<Fn extends Func> {
1112 identity: string;
1113
1114 /** 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. */
1115 callThrough(): Spy<Fn>;
1116 /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
1117 returnValue(val: ReturnType<Fn>): Spy<Fn>;
1118 /** 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. */
1119 returnValues(...values: Array<ReturnType<Fn>>): Spy<Fn>;
1120 /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
1121 callFake(fn: Fn): Spy<Fn>;
1122 /** Tell the spy to return a promise resolving to the specified value when invoked. */
1123 resolveTo(val?: PromisedReturnType<Fn>): Spy<Fn>;
1124 /** Tell the spy to return a promise rejecting with the specified value when invoked. */
1125 rejectWith(val?: PromisedRejectType<Fn>): Spy<Fn>;
1126 /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
1127 throwError(msg: string | Error): Spy;
1128 /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
1129 stub(): Spy;
1130 }
1131
1132 interface Calls<Fn extends Func> {
1133 /** 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. */
1134 any(): boolean;
1135 /** By chaining the spy with calls.count(), will return the number of times the spy was called */
1136 count(): number;
1137 /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index */
1138 argsFor(index: number): Parameters<Fn>;
1139 /** By chaining the spy with calls.allArgs(), will return the arguments to all calls */
1140 allArgs(): ReadonlyArray<Parameters<Fn>>;
1141 /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls */
1142 all(): ReadonlyArray<CallInfo<Fn>>;
1143 /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call */
1144 mostRecent(): CallInfo<Fn>;
1145 /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call */
1146 first(): CallInfo<Fn>;
1147 /** By chaining the spy with calls.reset(), will clears all tracking for a spy */
1148 reset(): void;
1149 /** Set this spy to do a shallow clone of arguments passed to each invocation. */
1150 saveArgumentsByValue(): void;
1151 /** Get the "this" object that was passed to a specific invocation of this spy. */
1152 thisFor(index: number): any;
1153 }
1154
1155 interface CallInfo<Fn extends Func> {
1156 /** The context (the this) for the call */
1157 object: any;
1158 /** All arguments passed to the call */
1159 args: Parameters<Fn>;
1160 /** The return value of the call */
1161 returnValue: ReturnType<Fn>;
1162 }
1163
1164 interface Util {
1165 inherit(childClass: Function, parentClass: Function): any;
1166 formatException(e: any): any;
1167 htmlEscape(str: string): string;
1168 argsToArray(args: any): any;
1169 extend(destination: any, source: any): any;
1170 }
1171
1172 interface JsApiReporter extends CustomReporter {
1173 new (): any;
1174
1175 started: boolean;
1176 finished: boolean;
1177 runDetails: JasmineDoneInfo;
1178
1179 status(): string;
1180 suiteResults(index: number, length: number): SuiteResult[];
1181 specResults(index: number, length: number): SpecResult[];
1182 suites(): { [id: string]: SuiteResult };
1183 specs(): SpecResult[];
1184 executionTime(): number;
1185 }
1186
1187 interface Jasmine {
1188 Spec: Spec;
1189 clock: Clock;
1190 util: Util;
1191 }
1192
1193 var HtmlReporter: HtmlReporter;
1194 var HtmlSpecFilter: HtmlSpecFilter;
1195
1196 /**
1197 * Default number of milliseconds Jasmine will wait for an asynchronous spec to complete.
1198 */
1199 var DEFAULT_TIMEOUT_INTERVAL: number;
1200
1201 /**
1202 * Maximum number of array elements to display when pretty printing objects.
1203 * This will also limit the number of keys and values displayed for an object.
1204 * Elements past this number will be ellipised.
1205 */
1206 var MAX_PRETTY_PRINT_ARRAY_LENGTH: number;
1207
1208 /**
1209 * Maximum number of characters to display when pretty printing objects.
1210 * Characters past this number will be ellipised.
1211 */
1212 var MAX_PRETTY_PRINT_CHARS: number;
1213
1214 /**
1215 * Maximum object depth the pretty printer will print to.
1216 * Set this to a lower value to speed up pretty printing if you have large objects.
1217 */
1218 var MAX_PRETTY_PRINT_DEPTH: number;
1219
1220 var version: string;
1221
1222 interface JasmineOptions {
1223 /**
1224 * The path to the project's base directory. This can be absolute or relative
1225 * to the current working directory. If it isn't specified, the current working
1226 * directory will be used.
1227 */
1228 projectBaseDir?: string;
1229 }
1230
1231 interface JasmineConfig {
1232 /**
1233 * Whether to fail specs that contain no expectations.
1234 * @default false
1235 */
1236 failSpecWithNoExpectations?: boolean;
1237 /**
1238 * An array of helper file paths or globs that match helper files. Each path or
1239 * glob will be evaluated relative to the spec directory. Helpers are loaded before specs.
1240 */
1241 helpers?: string[];
1242 /**
1243 * Specifies how to load files with names ending in .js. Valid values are
1244 * "require" and "import". "import" should be safe in all cases, and is
1245 * required if your project contains ES modules with filenames ending in .js.
1246 * @default "require"
1247 */
1248 jsLoader?: "require" | "import";
1249 /**
1250 * Whether to run specs in a random order.
1251 */
1252 random?: boolean;
1253 /**
1254 * An array of module names to load via require() at the start of execution.
1255 */
1256 requires?: string[];
1257 /**
1258 * The directory that spec files are contained in, relative to the project base directory.
1259 */
1260 spec_dir?: string;
1261 /**
1262 * An array of spec file paths or globs that match helper files. Each path
1263 * or glob will be evaluated relative to the spec directory.
1264 */
1265 spec_files?: string[];
1266 /**
1267 * Whether to stop suite execution on the first spec failure.
1268 */
1269 stopOnSpecFailure?: boolean;
1270 /**
1271 * Whether to stop each spec on the first expectation failure.
1272 */
1273 stopSpecOnExpectationFailure?: boolean;
1274 }
1275
1276 interface DefaultReporterOptions {
1277 timer?: any;
1278 print?: (...args: any[]) => void;
1279 showColors?: boolean;
1280 jasmineCorePath?: string;
1281 }
1282}
1283
1284declare module "jasmine" {
1285 class jasmine {
1286 jasmine: jasmine.Jasmine;
1287 env: jasmine.Env;
1288 /**
1289 * @deprecated Private property that may be changed or removed in the future
1290 */
1291 reportersCount: number;
1292 /**
1293 * @deprecated Private property that may be changed or removed in the future
1294 */
1295 completionReporter: jasmine.CustomReporter;
1296 /**
1297 * @deprecated Private property that may be changed or removed in the future
1298 */
1299 reporter: jasmine.CustomReporter;
1300 /**
1301 * @deprecated Private property that may be changed or removed in the future
1302 */
1303 showingColors: boolean;
1304 /**
1305 * @deprecated Private property that may be changed or removed in the future
1306 */
1307 projectBaseDir: string;
1308 /**
1309 * @deprecated Private property that may be changed or removed in the future
1310 */
1311 specDir: string;
1312 /**
1313 * @deprecated Private property that may be changed or removed in the future
1314 */
1315 specFiles: string[];
1316 /**
1317 * @deprecated Private property that may be changed or removed in the future
1318 */
1319 helperFiles: string[];
1320 /**
1321 * @deprecated Private property that may be changed or removed in the future
1322 */
1323 requires: string[];
1324 /**
1325 * @deprecated Private property that may be changed or removed in the future
1326 */
1327 onCompleteCallbackAdded: boolean;
1328 /**
1329 * @deprecated Private property that may be changed or removed in the future
1330 */
1331 defaultReporterConfigured: boolean;
1332
1333 constructor(options?: jasmine.JasmineOptions);
1334 addMatchers(matchers: jasmine.CustomMatcherFactories): void;
1335 /**
1336 * Add a custom reporter to the Jasmine environment.
1337 */
1338 addReporter(reporter: jasmine.CustomReporter): void;
1339 /**
1340 * Adds a spec file to the list that will be loaded when the suite is executed.
1341 */
1342 addSpecFile(filePath: string): void;
1343 /**
1344 * @deprecated Use addMatchingSpecFiles, loadConfig, or loadConfigFile instead
1345 */
1346 addSpecFiles(files: string[]): void;
1347 addMatchingSpecFiles(patterns: string[]): void;
1348 addHelperFile(filePath: string): void;
1349 /**
1350 * @deprecated Use addMatchingHelperFiles, loadConfig, or loadConfigFile instead
1351 */
1352 addHelperFiles(files: string[]): void;
1353 addMatchingHelperFiles(patterns: string[]): void;
1354 /**
1355 * @deprecated Private method that may be changed or removed in the future
1356 */
1357 addRequires(files: string[]): void;
1358 /**
1359 * Configure the default reporter.
1360 */
1361 configureDefaultReporter(options: jasmine.DefaultReporterOptions): void;
1362 execute(files?: string[], filterString?: string): Promise<jasmine.JasmineDoneInfo>;
1363 /**
1364 * @deprecated Private property that may be changed or removed in the future
1365 */
1366 exitCodeCompletion(passed: boolean): void;
1367 exitOnCompletion: boolean;
1368 loadConfig(config: jasmine.JasmineConfig): void;
1369 loadConfigFile(configFilePath?: string): void;
1370 /**
1371 * @deprecated Private method that may be changed or removed in the future
1372 */
1373 loadHelpers(): Promise<void>;
1374 /**
1375 * @deprecated Private method that may be changed or removed in the future
1376 */
1377 loadSpecs(): Promise<void>;
1378 /**
1379 * @deprecated Private method that may be changed or removed in the future
1380 */
1381 loadRequires(): void;
1382
1383 /**
1384 * @deprecated set exitOnCompletion to false and use the promise returned
1385 * from execute() instead.
1386 */
1387 onComplete(onCompleteCallback: (passed: boolean) => void): void;
1388 /**
1389 * Provide a fallback reporter if no other reporters have been specified.
1390 */
1391 provideFallbackReporter(reporter: jasmine.CustomReporter): void;
1392 /**
1393 * Clears all registered reporters.
1394 */
1395 clearReporters(): void;
1396 /**
1397 * Sets whether to randomize the order of specs.
1398 */
1399 randomizeTests(value: boolean): void;
1400 /**
1401 * Sets the random seed.
1402 */
1403 seed(value: number): void;
1404 /**
1405 * Sets whether to show colors in the console reporter.
1406 */
1407 showColors(value: boolean): void;
1408 stopSpecOnExpectationFailure(value: boolean): void;
1409 stopOnSpecFailure(value: boolean): void;
1410 static ConsoleReporter(): any;
1411
1412 /**
1413 * The version of jasmine-core in use
1414 */
1415 coreVersion(): string;
1416 }
1417 export = jasmine;
1418}