1 | type ImplementationCallback = (() => Promise<any>) | ((done: DoneFn) => void);
|
2 |
|
3 | /**
|
4 | * Create a group of specs (often called a suite).
|
5 | * @param description Textual description of the group
|
6 | * @param specDefinitions Function for Jasmine to invoke that will define inner suites a specs
|
7 | */
|
8 | declare function describe(description: string, specDefinitions: () => void): void;
|
9 | declare function fdescribe(description: string, specDefinitions: () => void): void;
|
10 | declare function xdescribe(description: string, specDefinitions: () => void): void;
|
11 |
|
12 | /**
|
13 | * Define a single spec. A spec should contain one or more expectations that test the state of the code.
|
14 | * A spec whose expectations all succeed will be passing and a spec with any failures will fail.
|
15 | * @param expectation Textual description of what this spec is checking
|
16 | * @param assertion Function that contains the code of your test. If not provided the test will be pending.
|
17 | * @param timeout Custom timeout for an async spec.
|
18 | */
|
19 | declare function it(expectation: string, assertion?: ImplementationCallback, timeout?: number): void;
|
20 |
|
21 | /**
|
22 | * A focused it
|
23 | * If suites or specs are focused, only those that are focused will be executed.
|
24 | * @param expectation
|
25 | * @param assertion
|
26 | * @param timeout
|
27 | */
|
28 | declare function fit(expectation: string, assertion?: ImplementationCallback, timeout?: number): void;
|
29 | declare function xit(expectation: string, assertion?: ImplementationCallback, timeout?: number): void;
|
30 |
|
31 | /**
|
32 | * Mark a spec as pending, expectation results will be ignored.
|
33 | * If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending.
|
34 | * @param reason
|
35 | * @returns {}
|
36 | */
|
37 | declare function pending(reason?: string): void;
|
38 |
|
39 | /**
|
40 | * Run some shared setup before each of the specs in the describe in which it is called.
|
41 | * @param action Function that contains the code to setup your specs.
|
42 | * @param timeout Custom timeout for an async beforeEach.
|
43 | */
|
44 | declare function beforeEach(action: ImplementationCallback, timeout?: number): void;
|
45 |
|
46 | /**
|
47 | * Run some shared teardown after each of the specs in the describe in which it is called.
|
48 | * @param action Function that contains the code to teardown your specs.
|
49 | * @param timeout Custom timeout for an async afterEach.
|
50 | */
|
51 | declare function afterEach(action: ImplementationCallback, timeout?: number): void;
|
52 |
|
53 | /**
|
54 | * Run some shared setup once before all of the specs in the describe are run.
|
55 | * 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.
|
56 | * @param action Function that contains the code to setup your specs.
|
57 | * @param timeout Custom timeout for an async beforeAll.
|
58 | */
|
59 | declare function beforeAll(action: ImplementationCallback, timeout?: number): void;
|
60 |
|
61 | /**
|
62 | * Run some shared teardown once after all of the specs in the describe are called.
|
63 | * 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.
|
64 | * @param action Function that contains the code to teardown your specs.
|
65 | * @param timeout Custom timeout for an async afterAll
|
66 | */
|
67 | declare function afterAll(action: ImplementationCallback, timeout?: number): void;
|
68 |
|
69 | /**
|
70 | * Create an expectation for a spec.
|
71 | * @param spy
|
72 | */
|
73 | declare function expect(spy: Function): jasmine.Matchers<any>;
|
74 |
|
75 | /**
|
76 | * Create an expectation for a spec.
|
77 | * @param actual
|
78 | */
|
79 | declare function expect<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
|
80 |
|
81 | /**
|
82 | * Create an expectation for a spec.
|
83 | * @param actual Actual computed value to test expectations against.
|
84 | */
|
85 | declare function expect<T>(actual: T): jasmine.Matchers<T>;
|
86 |
|
87 | /**
|
88 | * Create an expectation for a spec.
|
89 | */
|
90 | declare function expect(): jasmine.NothingMatcher;
|
91 |
|
92 | /**
|
93 | * Explicitly mark a spec as failed.
|
94 | * @param e
|
95 | */
|
96 | declare function fail(e?: any): void;
|
97 |
|
98 | /** Action method that should be called when the async work is complete */
|
99 | interface DoneFn extends Function {
|
100 | (): void;
|
101 |
|
102 | /** fails the spec and indicates that it has completed. If the message is an Error, Error.message is used */
|
103 | fail: (message?: Error | string) => void;
|
104 | }
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | declare function spyOn<T>(object: T, method: keyof T): jasmine.Spy;
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 | declare function spyOnProperty<T>(object: T, property: keyof T, accessType?: "get" | "set"): jasmine.Spy;
|
120 |
|
121 | declare function runs(asyncMethod: Function): void;
|
122 | declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void;
|
123 | declare function waits(timeout?: number): void;
|
124 |
|
125 | declare namespace jasmine {
|
126 | type Expected<T> = T | ObjectContaining<T> | Any | Spy;
|
127 | type SpyObjMethodNames<T = undefined> = T extends undefined
|
128 | ? (ReadonlyArray<string> | { [methodName: string]: any })
|
129 | : (ReadonlyArray<keyof T> | { [P in keyof T]?: ReturnType<T[P] extends (...args: any[]) => any ? T[P] : any> });
|
130 |
|
131 | var clock: () => Clock;
|
132 |
|
133 | var matchersUtil: MatchersUtil;
|
134 |
|
135 | function any(aclass: any): Any;
|
136 |
|
137 | function anything(): Any;
|
138 |
|
139 | function arrayContaining<T>(sample: ArrayLike<T>): ArrayContaining<T>;
|
140 | function arrayWithExactContents<T>(sample: ArrayLike<T>): ArrayContaining<T>;
|
141 | function objectContaining<T>(sample: Partial<T>): ObjectContaining<T>;
|
142 | function createSpy(name?: string, originalFn?: Function): Spy;
|
143 |
|
144 | function createSpyObj(baseName: string, methodNames: SpyObjMethodNames): any;
|
145 | function createSpyObj<T>(baseName: string, methodNames: SpyObjMethodNames<T>): SpyObj<T>;
|
146 |
|
147 | function createSpyObj(methodNames: SpyObjMethodNames): any;
|
148 | function createSpyObj<T>(methodNames: SpyObjMethodNames): SpyObj<T>;
|
149 |
|
150 | function pp(value: any): string;
|
151 |
|
152 | function getEnv(): Env;
|
153 |
|
154 | function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
|
155 |
|
156 | function addMatchers(matchers: CustomMatcherFactories): void;
|
157 |
|
158 | function stringMatching(str: string): Any;
|
159 | function stringMatching(str: RegExp): Any;
|
160 |
|
161 | function formatErrorMsg(domain: string, usage: string): (msg: string) => string;
|
162 |
|
163 | interface Any {
|
164 | (...params: any[]): any;
|
165 | new(expectedClass: any): any;
|
166 |
|
167 | jasmineMatches(other: any): boolean;
|
168 | jasmineToString(): string;
|
169 | }
|
170 |
|
171 |
|
172 | interface ArrayLike<T> {
|
173 | length: number;
|
174 | [n: number]: T;
|
175 | }
|
176 |
|
177 | interface ArrayContaining<T> {
|
178 | new(sample: ArrayLike<T>): ArrayLike<T>;
|
179 |
|
180 | asymmetricMatch(other: any): boolean;
|
181 | jasmineToString(): string;
|
182 | }
|
183 |
|
184 | interface ObjectContaining<T> {
|
185 | new(sample: Partial<T>): Partial<T>;
|
186 |
|
187 | jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
|
188 | jasmineToString(): string;
|
189 | }
|
190 |
|
191 | interface Block {
|
192 | new(env: Env, func: SpecFunction, spec: Spec): any;
|
193 |
|
194 | execute(onComplete: () => void): void;
|
195 | }
|
196 |
|
197 | interface WaitsBlock extends Block {
|
198 | new(env: Env, timeout: number, spec: Spec): any;
|
199 | }
|
200 |
|
201 | interface WaitsForBlock extends Block {
|
202 | new(env: Env, timeout: number, latchFunction: SpecFunction, message: string, spec: Spec): any;
|
203 | }
|
204 |
|
205 | interface Clock {
|
206 | install(): void;
|
207 | uninstall(): void;
|
208 |
|
209 | tick(ms: number): void;
|
210 | mockDate(date?: Date): void;
|
211 | withMock(func: () => void): void;
|
212 | }
|
213 |
|
214 | type CustomEqualityTester = (first: any, second: any) => boolean | void;
|
215 |
|
216 | interface CustomMatcher {
|
217 | compare<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
|
218 | compare(actual: any, ...expected: any[]): CustomMatcherResult;
|
219 | negativeCompare?<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
|
220 | negativeCompare?(actual: any, ...expected: any[]): CustomMatcherResult;
|
221 | }
|
222 |
|
223 | type CustomMatcherFactory = (util: MatchersUtil, customEqualityTesters: CustomEqualityTester[]) => CustomMatcher;
|
224 |
|
225 | interface CustomMatcherFactories {
|
226 | [index: string]: CustomMatcherFactory;
|
227 | }
|
228 |
|
229 | interface CustomMatcherResult {
|
230 | pass: boolean;
|
231 | message?: string | undefined;
|
232 | }
|
233 |
|
234 | interface MatchersUtil {
|
235 | equals(a: any, b: any, customTesters?: CustomEqualityTester[]): boolean;
|
236 | contains<T>(haystack: ArrayLike<T> | string, needle: any, customTesters?: CustomEqualityTester[]): boolean;
|
237 | buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string;
|
238 | }
|
239 |
|
240 | interface Env {
|
241 | setTimeout: any;
|
242 | clearTimeout: void;
|
243 | setInterval: any;
|
244 | clearInterval: void;
|
245 | updateInterval: number;
|
246 |
|
247 | currentSpec: Spec;
|
248 |
|
249 | matchersClass: Matchers<any>;
|
250 |
|
251 | version(): any;
|
252 | versionString(): string;
|
253 | nextSpecId(): number;
|
254 | addReporter(reporter: Reporter): void;
|
255 | addReporter(reporter: CustomReporter): void;
|
256 | execute(): void;
|
257 | describe(description: string, specDefinitions: () => void): Suite;
|
258 |
|
259 | beforeEach(beforeEachFunction: ImplementationCallback, timeout?: number): void;
|
260 | beforeAll(beforeAllFunction: ImplementationCallback, timeout?: number): void;
|
261 | currentRunner(): Runner;
|
262 | afterEach(afterEachFunction: ImplementationCallback, timeout?: number): void;
|
263 | afterAll(afterAllFunction: ImplementationCallback, timeout?: number): void;
|
264 | xdescribe(desc: string, specDefinitions: () => void): XSuite;
|
265 | it(description: string, func: () => void): Spec;
|
266 |
|
267 | xit(desc: string, func: () => void): XSpec;
|
268 | compareRegExps_(a: RegExp, b: RegExp, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
269 | compareObjects_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
270 | equals_(a: any, b: any, mismatchKeys: string[], mismatchValues: string[]): boolean;
|
271 | contains_(haystack: any, needle: any): boolean;
|
272 | addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
|
273 | addMatchers(matchers: CustomMatcherFactories): void;
|
274 | specFilter(spec: Spec): boolean;
|
275 | throwOnExpectationFailure(value: boolean): void;
|
276 | seed(seed: string | number): string | number;
|
277 | provideFallbackReporter(reporter: Reporter): void;
|
278 | throwingExpectationFailures(): boolean;
|
279 | allowRespy(allow: boolean): void;
|
280 | randomTests(): boolean;
|
281 | randomizeTests(b: boolean): void;
|
282 | clearReporters(): void;
|
283 | }
|
284 |
|
285 | interface FakeTimer {
|
286 | new(): any;
|
287 |
|
288 | reset(): void;
|
289 | tick(millis: number): void;
|
290 | runFunctionsWithinRange(oldMillis: number, nowMillis: number): void;
|
291 | scheduleFunction(timeoutKey: any, funcToCall: () => void, millis: number, recurring: boolean): void;
|
292 | }
|
293 |
|
294 | interface HtmlReporter {
|
295 | new(): any;
|
296 | }
|
297 |
|
298 | interface HtmlSpecFilter {
|
299 | new(): any;
|
300 | }
|
301 |
|
302 | interface Result {
|
303 | type: string;
|
304 | }
|
305 |
|
306 | interface NestedResults extends Result {
|
307 | description: string;
|
308 |
|
309 | totalCount: number;
|
310 | passedCount: number;
|
311 | failedCount: number;
|
312 |
|
313 | skipped: boolean;
|
314 |
|
315 | rollupCounts(result: NestedResults): void;
|
316 | log(values: any): void;
|
317 | getItems(): Result[];
|
318 | addResult(result: Result): void;
|
319 | passed(): boolean;
|
320 | }
|
321 |
|
322 | interface MessageResult extends Result {
|
323 | values: any;
|
324 | trace: Trace;
|
325 | }
|
326 |
|
327 | interface ExpectationResult extends Result {
|
328 | matcherName: string;
|
329 | passed(): boolean;
|
330 | expected: any;
|
331 | actual: any;
|
332 | message: string;
|
333 | trace: Trace;
|
334 | }
|
335 |
|
336 | interface Order {
|
337 | new(options: { random: boolean; seed: string }): any;
|
338 | random: boolean;
|
339 | seed: string;
|
340 | sort<T>(items: T[]): T[];
|
341 | }
|
342 |
|
343 | namespace errors {
|
344 | class ExpectationFailed extends Error {
|
345 | constructor();
|
346 |
|
347 | stack: any;
|
348 | }
|
349 | }
|
350 |
|
351 | interface TreeProcessor {
|
352 | new(attrs: any): any;
|
353 | execute: (done: Function) => void;
|
354 | processTree(): any;
|
355 | }
|
356 |
|
357 | interface Trace {
|
358 | name: string;
|
359 | message: string;
|
360 | stack: any;
|
361 | }
|
362 |
|
363 | interface PrettyPrinter {
|
364 | new(): any;
|
365 |
|
366 | format(value: any): void;
|
367 | iterateObject(obj: any, fn: (property: string, isGetter: boolean) => void): void;
|
368 | emitScalar(value: any): void;
|
369 | emitString(value: string): void;
|
370 | emitArray(array: any[]): void;
|
371 | emitObject(obj: any): void;
|
372 | append(value: any): void;
|
373 | }
|
374 |
|
375 | interface StringPrettyPrinter extends PrettyPrinter {
|
376 | }
|
377 |
|
378 | interface Queue {
|
379 | new(env: any): any;
|
380 |
|
381 | env: Env;
|
382 | ensured: boolean[];
|
383 | blocks: Block[];
|
384 | running: boolean;
|
385 | index: number;
|
386 | offset: number;
|
387 | abort: boolean;
|
388 |
|
389 | addBefore(block: Block, ensure?: boolean): void;
|
390 | add(block: any, ensure?: boolean): void;
|
391 | insertNext(block: any, ensure?: boolean): void;
|
392 | start(onComplete?: () => void): void;
|
393 | isRunning(): boolean;
|
394 | next_(): void;
|
395 | results(): NestedResults;
|
396 | }
|
397 |
|
398 | interface Matchers<T> {
|
399 | new(env: Env, actual: T, spec: Env, isNot?: boolean): any;
|
400 |
|
401 | env: Env;
|
402 | actual: T;
|
403 | spec: Env;
|
404 | isNot?: boolean | undefined;
|
405 | message(): any;
|
406 |
|
407 | |
408 |
|
409 |
|
410 |
|
411 |
|
412 | toBe(expected: Expected<T>, expectationFailOutput?: any): boolean;
|
413 |
|
414 | |
415 |
|
416 |
|
417 |
|
418 |
|
419 | toEqual(expected: Expected<T>, expectationFailOutput?: any): boolean;
|
420 | toMatch(expected: string | RegExp, expectationFailOutput?: any): boolean;
|
421 | toBeDefined(expectationFailOutput?: any): boolean;
|
422 | toBeUndefined(expectationFailOutput?: any): boolean;
|
423 | toBeNull(expectationFailOutput?: any): boolean;
|
424 | toBeNaN(): boolean;
|
425 | toBeTruthy(expectationFailOutput?: any): boolean;
|
426 | toBeFalsy(expectationFailOutput?: any): boolean;
|
427 | toHaveBeenCalled(): boolean;
|
428 | toHaveBeenCalledBefore(expected: Spy): boolean;
|
429 | toHaveBeenCalledWith(...params: any[]): boolean;
|
430 | toHaveBeenCalledTimes(expected: number): boolean;
|
431 | toContain(expected: any, expectationFailOutput?: any): boolean;
|
432 | toBeLessThan(expected: number, expectationFailOutput?: any): boolean;
|
433 | toBeLessThanOrEqual(expected: number, expectationFailOutput?: any): boolean;
|
434 | toBeGreaterThan(expected: number, expectationFailOutput?: any): boolean;
|
435 | toBeGreaterThanOrEqual(expected: number, expectationFailOutput?: any): boolean;
|
436 | toBeCloseTo(expected: number, precision?: any, expectationFailOutput?: any): boolean;
|
437 | toThrow(expected?: any): boolean;
|
438 | toThrowError(message?: string | RegExp): boolean;
|
439 | toThrowError(expected?: new(...args: any[]) => Error, message?: string | RegExp): boolean;
|
440 |
|
441 | not: Matchers<T>;
|
442 |
|
443 | Any: Any;
|
444 | }
|
445 |
|
446 | interface ArrayLikeMatchers<T> extends Matchers<ArrayLike<T>> {
|
447 | toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput?: any): boolean;
|
448 | toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput?: any): boolean;
|
449 | toContain(expected: Expected<T>, expectationFailOutput?: any): boolean;
|
450 | not: ArrayLikeMatchers<T>;
|
451 | }
|
452 |
|
453 | interface NothingMatcher {
|
454 | nothing(): void;
|
455 | }
|
456 |
|
457 | interface Reporter {
|
458 | reportRunnerStarting(runner: Runner): void;
|
459 | reportRunnerResults(runner: Runner): void;
|
460 | reportSuiteResults(suite: Suite): void;
|
461 | reportSpecStarting(spec: Spec): void;
|
462 | reportSpecResults(spec: Spec): void;
|
463 | log(str: string): void;
|
464 | }
|
465 |
|
466 | interface MultiReporter extends Reporter {
|
467 | addReporter(reporter: Reporter): void;
|
468 | }
|
469 |
|
470 | interface SuiteInfo {
|
471 | totalSpecsDefined: number;
|
472 | }
|
473 |
|
474 | interface CustomReportExpectation {
|
475 | matcherName: string;
|
476 | message: string;
|
477 | passed: boolean;
|
478 | stack: string;
|
479 | }
|
480 |
|
481 | interface FailedExpectation extends CustomReportExpectation {
|
482 | actual: string;
|
483 | expected: string;
|
484 | }
|
485 |
|
486 | interface PassedExpectation extends CustomReportExpectation {
|
487 | }
|
488 |
|
489 | interface CustomReporterResult {
|
490 | description: string;
|
491 | failedExpectations?: FailedExpectation[] | undefined;
|
492 | fullName: string;
|
493 | id: string;
|
494 | passedExpectations?: PassedExpectation[] | undefined;
|
495 | pendingReason?: string | undefined;
|
496 | status?: string | undefined;
|
497 | }
|
498 |
|
499 | interface RunDetails {
|
500 | failedExpectations: ExpectationResult[];
|
501 | order: jasmine.Order;
|
502 | }
|
503 |
|
504 | interface CustomReporter {
|
505 | jasmineStarted?(suiteInfo: SuiteInfo): void;
|
506 | suiteStarted?(result: CustomReporterResult): void;
|
507 | specStarted?(result: CustomReporterResult): void;
|
508 | specDone?(result: CustomReporterResult): void;
|
509 | suiteDone?(result: CustomReporterResult): void;
|
510 | jasmineDone?(runDetails: RunDetails): void;
|
511 | }
|
512 |
|
513 | interface Runner {
|
514 | new(env: Env): any;
|
515 |
|
516 | execute(): void;
|
517 | beforeEach(beforeEachFunction: SpecFunction): void;
|
518 | afterEach(afterEachFunction: SpecFunction): void;
|
519 | beforeAll(beforeAllFunction: SpecFunction): void;
|
520 | afterAll(afterAllFunction: SpecFunction): void;
|
521 | finishCallback(): void;
|
522 | addSuite(suite: Suite): void;
|
523 | add(block: Block): void;
|
524 | specs(): Spec[];
|
525 | suites(): Suite[];
|
526 | topLevelSuites(): Suite[];
|
527 | results(): NestedResults;
|
528 | }
|
529 |
|
530 | type SpecFunction = (spec?: Spec) => void;
|
531 |
|
532 | interface SuiteOrSpec {
|
533 | id: number;
|
534 | env: Env;
|
535 | description: string;
|
536 | queue: Queue;
|
537 | }
|
538 |
|
539 | interface Spec extends SuiteOrSpec {
|
540 | new(env: Env, suite: Suite, description: string): any;
|
541 |
|
542 | suite: Suite;
|
543 |
|
544 | afterCallbacks: SpecFunction[];
|
545 | spies_: Spy[];
|
546 |
|
547 | results_: NestedResults;
|
548 | matchersClass: Matchers<any>;
|
549 |
|
550 | getFullName(): string;
|
551 | results(): NestedResults;
|
552 | log(arguments: any): any;
|
553 | runs(func: SpecFunction): Spec;
|
554 | addToQueue(block: Block): void;
|
555 | addMatcherResult(result: Result): void;
|
556 | getResult(): any;
|
557 | expect(actual: any): any;
|
558 | waits(timeout: number): Spec;
|
559 | waitsFor(latchFunction: SpecFunction, timeoutMessage?: string, timeout?: number): Spec;
|
560 | fail(e?: any): void;
|
561 | getMatchersClass_(): Matchers<any>;
|
562 | addMatchers(matchersPrototype: CustomMatcherFactories): void;
|
563 | finishCallback(): void;
|
564 | finish(onComplete?: () => void): void;
|
565 | after(doAfter: SpecFunction): void;
|
566 | execute(onComplete?: () => void, enabled?: boolean): any;
|
567 | addBeforesAndAftersToQueue(): void;
|
568 | explodes(): void;
|
569 | spyOn(obj: any, methodName: string, ignoreMethodDoesntExist: boolean): Spy;
|
570 | spyOnProperty(object: any, property: string, accessType?: "get" | "set"): Spy;
|
571 | removeAllSpies(): void;
|
572 | throwOnExpectationFailure: boolean;
|
573 | }
|
574 |
|
575 | interface XSpec {
|
576 | id: number;
|
577 | runs(): void;
|
578 | }
|
579 |
|
580 | interface Suite extends SuiteOrSpec {
|
581 | new(env: Env, description: string, specDefinitions: () => void, parentSuite: Suite): any;
|
582 |
|
583 | parentSuite: Suite;
|
584 |
|
585 | getFullName(): string;
|
586 | finish(onComplete?: () => void): void;
|
587 | beforeEach(beforeEachFunction: SpecFunction): void;
|
588 | afterEach(afterEachFunction: SpecFunction): void;
|
589 | beforeAll(beforeAllFunction: SpecFunction): void;
|
590 | afterAll(afterAllFunction: SpecFunction): void;
|
591 | results(): NestedResults;
|
592 | add(suiteOrSpec: SuiteOrSpec): void;
|
593 | specs(): Spec[];
|
594 | suites(): Suite[];
|
595 | children(): any[];
|
596 | execute(onComplete?: () => void): void;
|
597 | }
|
598 |
|
599 | interface XSuite {
|
600 | execute(): void;
|
601 | }
|
602 |
|
603 | interface Spy {
|
604 | (...params: any[]): any;
|
605 |
|
606 | and: SpyAnd;
|
607 | calls: Calls;
|
608 | }
|
609 |
|
610 | type SpyObj<T> =
|
611 | & T
|
612 | & {
|
613 | [k in keyof T]: T[k] extends Function ? T[k] & Spy : T[k];
|
614 | };
|
615 |
|
616 | interface SpyAnd {
|
617 | identity: string;
|
618 |
|
619 |
|
620 | callThrough(): Spy;
|
621 |
|
622 | returnValue(val: any): Spy;
|
623 |
|
624 | returnValues(...values: any[]): Spy;
|
625 |
|
626 | callFake(fn: Function): Spy;
|
627 |
|
628 | throwError(msg: string): Spy;
|
629 |
|
630 | stub(): Spy;
|
631 | }
|
632 |
|
633 | interface Calls {
|
634 |
|
635 | any(): boolean;
|
636 |
|
637 | count(): number;
|
638 |
|
639 | argsFor(index: number): any[];
|
640 |
|
641 | allArgs(): any[];
|
642 |
|
643 | all(): CallInfo[];
|
644 |
|
645 | mostRecent(): CallInfo;
|
646 |
|
647 | first(): CallInfo;
|
648 |
|
649 | reset(): void;
|
650 |
|
651 | saveArgumentsByValue(): void;
|
652 | }
|
653 |
|
654 | interface CallInfo {
|
655 |
|
656 | object: any;
|
657 |
|
658 | args: any[];
|
659 |
|
660 | returnValue: any;
|
661 | }
|
662 |
|
663 | interface Util {
|
664 | inherit(childClass: Function, parentClass: Function): any;
|
665 | formatException(e: any): any;
|
666 | htmlEscape(str: string): string;
|
667 | argsToArray(args: any): any;
|
668 | extend(destination: any, source: any): any;
|
669 | }
|
670 |
|
671 | interface JsApiReporter extends Reporter {
|
672 | started: boolean;
|
673 | finished: boolean;
|
674 | result: any;
|
675 | messages: any;
|
676 | runDetails: RunDetails;
|
677 |
|
678 | new(): any;
|
679 |
|
680 | suites(): Suite[];
|
681 | summarize_(suiteOrSpec: SuiteOrSpec): any;
|
682 | results(): any;
|
683 | resultsForSpec(specId: any): any;
|
684 | log(str: any): any;
|
685 | resultsForSpecs(specIds: any): any;
|
686 | summarizeResult_(result: any): any;
|
687 | }
|
688 |
|
689 | interface Jasmine {
|
690 | Spec: Spec;
|
691 | clock: Clock;
|
692 | util: Util;
|
693 | }
|
694 |
|
695 | export var HtmlReporter: HtmlReporter;
|
696 | export var HtmlSpecFilter: HtmlSpecFilter;
|
697 | export var DEFAULT_TIMEOUT_INTERVAL: number;
|
698 | export var MAX_PRETTY_PRINT_DEPTH: number;
|
699 | }
|
700 |
|
701 | declare module "jasmine" {
|
702 | class jasmine {
|
703 | constructor(options: any);
|
704 | jasmine: jasmine.Jasmine;
|
705 | addMatchers(matchers: jasmine.CustomMatcherFactories): void;
|
706 | addReporter(reporter: jasmine.Reporter): void;
|
707 | addSpecFile(filePath: string): void;
|
708 | addSpecFiles(files: string[]): void;
|
709 | configureDefaultReporter(options: any, ...args: any[]): void;
|
710 | execute(files?: string[], filterString?: string): any;
|
711 | exitCodeCompletion(passed: any): void;
|
712 | loadConfig(config: any): void;
|
713 | loadConfigFile(configFilePath: any): void;
|
714 | loadHelpers(): void;
|
715 | loadSpecs(): void;
|
716 | onComplete(onCompleteCallback: (passed: boolean) => void): void;
|
717 | provideFallbackReporter(reporter: jasmine.Reporter): void;
|
718 | randomizeTests(value?: any): boolean;
|
719 | seed(value: any): void;
|
720 | showColors(value: any): void;
|
721 | stopSpecOnExpectationFailure(value: any): void;
|
722 | static ConsoleReporter(): any;
|
723 | env: jasmine.Env;
|
724 | reportersCount: number;
|
725 | completionReporter: jasmine.CustomReporter;
|
726 | reporter: jasmine.CustomReporter;
|
727 | coreVersion(): string;
|
728 | showingColors: boolean;
|
729 | projectBaseDir: string;
|
730 | printDeprecation(): void;
|
731 | specFiles: string[];
|
732 | helperFiles: string[];
|
733 | }
|
734 | export = jasmine;
|
735 | }
|