index.d.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. declare type ImplementationCallback = jasmine.ImplementationCallback;
  2. declare function describe(description: string, specDefinitions: () => void): void;
  3. declare function fdescribe(description: string, specDefinitions: () => void): void;
  4. declare function xdescribe(description: string, specDefinitions: () => void): void;
  5. declare function it(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void;
  6. declare function fit(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void;
  7. declare function xit(expectation: string, assertion?: jasmine.ImplementationCallback, timeout?: number): void;
  8. declare function pending(reason?: string): void;
  9. declare function setSpecProperty(key: string, value: unknown): void;
  10. declare function setSuiteProperty(key: string, value: unknown): void;
  11. declare function beforeEach(action: jasmine.ImplementationCallback, timeout?: number): void;
  12. declare function afterEach(action: jasmine.ImplementationCallback, timeout?: number): void;
  13. declare function beforeAll(action: jasmine.ImplementationCallback, timeout?: number): void;
  14. declare function afterAll(action: jasmine.ImplementationCallback, timeout?: number): void;
  15. declare function expect<T extends jasmine.Func>(spy: T | jasmine.Spy<T>): jasmine.FunctionMatchers<T>;
  16. declare function expect<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
  17. declare function expect<T>(actual: T): jasmine.Matchers<T>;
  18. declare function expect(): jasmine.NothingMatcher;
  19. declare function expectAsync<T, U>(actual: T | PromiseLike<T>): jasmine.AsyncMatchers<T, U>;
  20. declare function fail(e?: any): void;
  21. interface DoneFn extends Function {
  22. (): void;
  23. fail: (message?: Error | string) => void;
  24. }
  25. declare function spyOn<T, K extends keyof T = keyof T>(object: T, method: T[K] extends Function ? K : never): jasmine.Spy<T[K] extends jasmine.Func ? T[K] : T[K] extends {
  26. new (...args: infer A): infer V;
  27. } ? (...args: A) => V : never>;
  28. declare function spyOnProperty<T, K extends keyof T = keyof T>(object: T, property: K, accessType?: "get"): jasmine.Spy<(this: T) => T[K]>;
  29. declare function spyOnProperty<T, K extends keyof T = keyof T>(object: T, property: K, accessType: "set"): jasmine.Spy<(this: T, value: T[K]) => void>;
  30. declare function spyOnAllFunctions<T>(object: T, includeNonEnumerable?: boolean): jasmine.SpyObj<T>;
  31. declare namespace jasmine {
  32. type Func = (...args: any[]) => any;
  33. type Constructor = Function & {
  34. prototype: any;
  35. };
  36. type ImplementationCallback = (() => PromiseLike<any>) | (() => void) | ((done: DoneFn) => void);
  37. type ExpectedRecursive<T> = T | ObjectContaining<T> | AsymmetricMatcher<any> | {
  38. [K in keyof T]: ExpectedRecursive<T[K]> | Any;
  39. };
  40. type Expected<T> = T | ObjectContaining<T> | AsymmetricMatcher<any> | Any | Spy | {
  41. [K in keyof T]: ExpectedRecursive<T[K]>;
  42. };
  43. type SpyObjMethodNames<T = undefined> = T extends undefined ? ReadonlyArray<string> | {
  44. [methodName: string]: any;
  45. } : (ReadonlyArray<keyof T> | {
  46. [P in keyof T]?: T[P] extends Func ? (ReturnType<T[P]> | (P extends keyof Object ? Object[P] : never)) : any;
  47. });
  48. type SpyObjPropertyNames<T = undefined> = T extends undefined ? ReadonlyArray<string> | {
  49. [propertyName: string]: any;
  50. } : ReadonlyArray<keyof T> | {
  51. [P in keyof T]?: T[P];
  52. };
  53. interface Configuration {
  54. random?: boolean | undefined;
  55. seed?: number | string | null | undefined;
  56. stopOnSpecFailure?: boolean | undefined;
  57. failSpecWithNoExpectations?: boolean | undefined;
  58. stopSpecOnExpectationFailure?: boolean | undefined;
  59. specFilter?: SpecFilter | undefined;
  60. hideDisabled?: boolean | undefined;
  61. Promise?: typeof Promise | undefined;
  62. autoCleanClosures?: boolean | undefined;
  63. }
  64. type EnvConfiguration = Configuration;
  65. function clock(): Clock;
  66. function DiffBuilder(): DiffBuilder;
  67. function any(aclass: Constructor | Symbol): AsymmetricMatcher<any>;
  68. function anything(): AsymmetricMatcher<any>;
  69. function truthy(): AsymmetricMatcher<any>;
  70. function falsy(): AsymmetricMatcher<any>;
  71. function empty(): AsymmetricMatcher<any>;
  72. function notEmpty(): AsymmetricMatcher<any>;
  73. function arrayContaining<T>(sample: ArrayLike<T>): ArrayContaining<T>;
  74. function arrayWithExactContents<T>(sample: ArrayLike<T>): ArrayContaining<T>;
  75. function objectContaining<T>(sample: {
  76. [K in keyof T]?: ExpectedRecursive<T[K]>;
  77. }): ObjectContaining<T>;
  78. function mapContaining<K, V>(sample: Map<K, V>): AsymmetricMatcher<Map<K, V>>;
  79. function setContaining<T>(sample: Set<T>): AsymmetricMatcher<Set<T>>;
  80. function setDefaultSpyStrategy<Fn extends Func = Func>(fn?: (and: SpyAnd<Fn>) => void): void;
  81. function spyOnGlobalErrorsAsync(fn?: (globalErrorSpy: Error) => Promise<void>): Promise<void>;
  82. function addSpyStrategy<Fn extends Func = Func>(name: string, factory: Fn): void;
  83. function createSpy<Fn extends Func>(name?: string, originalFn?: Fn): Spy<Fn>;
  84. function createSpyObj(baseName: string, methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any;
  85. function createSpyObj<T>(baseName: string, methodNames: SpyObjMethodNames<T>, propertyNames?: SpyObjPropertyNames<T>): SpyObj<T>;
  86. function createSpyObj(methodNames: SpyObjMethodNames, propertyNames?: SpyObjPropertyNames): any;
  87. function createSpyObj<T>(methodNames: SpyObjMethodNames<T>, propertyNames?: SpyObjPropertyNames<T>): SpyObj<T>;
  88. function getEnv(): Env;
  89. function debugLog(msg: string): void;
  90. function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
  91. function addCustomObjectFormatter(formatter: CustomObjectFormatter): void;
  92. function addMatchers(matchers: CustomMatcherFactories): void;
  93. function addAsyncMatchers(matchers: CustomAsyncMatcherFactories): void;
  94. function stringMatching(str: string | RegExp): AsymmetricMatcher<string>;
  95. function stringContaining(str: string | RegExp): AsymmetricMatcher<string>;
  96. function formatErrorMsg(domain: string, usage: string): (msg: string) => string;
  97. interface Any extends AsymmetricMatcher<any> {
  98. new (expectedClass: any): any;
  99. jasmineToString(prettyPrint: (value: any) => string): string;
  100. }
  101. interface AsymmetricMatcher<TValue> {
  102. asymmetricMatch(other: TValue, matchersUtil?: MatchersUtil): boolean;
  103. jasmineToString?(prettyPrint: (value: any) => string): string;
  104. }
  105. interface ArrayLike<T> {
  106. length: number;
  107. [n: number]: T;
  108. }
  109. interface ArrayContaining<T> extends AsymmetricMatcher<any> {
  110. new?(sample: ArrayLike<T>): ArrayLike<T>;
  111. jasmineToString(prettyPrint: (value: any) => string): string;
  112. }
  113. interface ObjectContaining<T> extends AsymmetricMatcher<T> {
  114. new?(sample: {
  115. [K in keyof T]?: any;
  116. }): {
  117. [K in keyof T]?: any;
  118. };
  119. jasmineToString?(prettyPrint: (value: any) => string): string;
  120. }
  121. interface Clock {
  122. install(): Clock;
  123. uninstall(): void;
  124. tick(ms: number): void;
  125. mockDate(date?: Date): void;
  126. withMock(func: () => void): void;
  127. }
  128. type CustomEqualityTester = (first: any, second: any) => boolean | void;
  129. type CustomObjectFormatter = (value: unknown) => string | undefined;
  130. interface CustomMatcher {
  131. compare<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
  132. compare(actual: any, ...expected: any[]): CustomMatcherResult;
  133. negativeCompare?<T>(actual: T, expected: T, ...args: any[]): CustomMatcherResult;
  134. negativeCompare?(actual: any, ...expected: any[]): CustomMatcherResult;
  135. }
  136. interface CustomAsyncMatcher {
  137. compare<T>(actual: T, expected: T, ...args: any[]): PromiseLike<CustomMatcherResult>;
  138. compare(actual: any, ...expected: any[]): PromiseLike<CustomMatcherResult>;
  139. negativeCompare?<T>(actual: T, expected: T, ...args: any[]): PromiseLike<CustomMatcherResult>;
  140. negativeCompare?(actual: any, ...expected: any[]): PromiseLike<CustomMatcherResult>;
  141. }
  142. type CustomMatcherFactory = (util: MatchersUtil) => CustomMatcher;
  143. type CustomAsyncMatcherFactory = (util: MatchersUtil) => CustomAsyncMatcher;
  144. interface CustomMatcherFactories {
  145. [name: string]: CustomMatcherFactory;
  146. }
  147. interface CustomAsyncMatcherFactories {
  148. [name: string]: CustomAsyncMatcherFactory;
  149. }
  150. interface CustomMatcherResult {
  151. pass: boolean;
  152. message?: string | undefined;
  153. }
  154. interface DiffBuilder {
  155. setRoots(actual: any, expected: any): void;
  156. recordMismatch(formatter?: (actual: any, expected: any, path?: any, prettyPrinter?: any) => string): void;
  157. withPath(pathComponent: string, block: () => void): void;
  158. getMessage(): string;
  159. }
  160. interface MatchersUtil {
  161. equals(a: any, b: any): boolean;
  162. contains<T>(haystack: ArrayLike<T> | string, needle: any): boolean;
  163. buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: any[]): string;
  164. pp(value: any): string;
  165. }
  166. interface Env {
  167. addReporter(reporter: CustomReporter): void;
  168. allowRespy(allow: boolean): void;
  169. clearReporters(): void;
  170. configuration(): Configuration;
  171. configure(configuration: Configuration): void;
  172. execute(runnablesToRun: Suite[] | null | undefined, onComplete: Func): void;
  173. execute(runnablesToRun?: Suite[]): PromiseLike<JasmineDoneInfo>;
  174. provideFallbackReporter(reporter: CustomReporter): void;
  175. setSpecProperty: typeof setSpecProperty;
  176. setSuiteProperty: typeof setSuiteProperty;
  177. topSuite(): Suite;
  178. }
  179. interface HtmlReporter {
  180. new (): any;
  181. }
  182. interface HtmlSpecFilter {
  183. new (): any;
  184. }
  185. interface Result {
  186. type: string;
  187. }
  188. interface ExpectationResult extends Result {
  189. matcherName: string;
  190. message: string;
  191. stack: string;
  192. passed: boolean;
  193. expected: any;
  194. actual: any;
  195. }
  196. interface DeprecationWarning extends Result {
  197. message: string;
  198. stack: string;
  199. }
  200. interface Order {
  201. new (options: {
  202. random: boolean;
  203. seed: number | string;
  204. }): any;
  205. random: boolean;
  206. seed: number | string;
  207. sort<T>(items: T[]): T[];
  208. }
  209. namespace errors {
  210. class ExpectationFailed extends Error {
  211. constructor();
  212. stack: any;
  213. }
  214. }
  215. interface Matchers<T> {
  216. toBe(expected: Expected<T>): void;
  217. toBe(expected: Expected<T>, expectationFailOutput: any): void;
  218. toEqual(expected: Expected<T>): void;
  219. toEqual(expected: Expected<T>, expectationFailOutput: any): void;
  220. toMatch(expected: string | RegExp): void;
  221. toMatch(expected: string | RegExp, expectationFailOutput: any): void;
  222. toBeDefined(): void;
  223. toBeDefined(expectationFailOutput: any): void;
  224. toBeUndefined(): void;
  225. toBeUndefined(expectationFailOutput: any): void;
  226. toBeNull(): void;
  227. toBeNull(expectationFailOutput: any): void;
  228. toBeNaN(): void;
  229. toBeTruthy(): void;
  230. toBeTruthy(expectationFailOutput: any): void;
  231. toBeFalsy(): void;
  232. toBeFalsy(expectationFailOutput: any): void;
  233. toBeTrue(): void;
  234. toBeFalse(): void;
  235. toHaveBeenCalled(): void;
  236. toHaveBeenCalledBefore(expected: Func): void;
  237. toHaveBeenCalledWith(...params: any[]): void;
  238. toHaveBeenCalledOnceWith(...params: any[]): void;
  239. toHaveBeenCalledTimes(expected: number): void;
  240. toContain(expected: any): void;
  241. toContain(expected: any, expectationFailOutput: any): void;
  242. toBeLessThan(expected: number): void;
  243. toBeLessThan(expected: number, expectationFailOutput: any): void;
  244. toBeLessThanOrEqual(expected: number): void;
  245. toBeLessThanOrEqual(expected: number, expectationFailOutput: any): void;
  246. toBeGreaterThan(expected: number): void;
  247. toBeGreaterThan(expected: number, expectationFailOutput: any): void;
  248. toBeGreaterThanOrEqual(expected: number): void;
  249. toBeGreaterThanOrEqual(expected: number, expectationFailOutput: any): void;
  250. toBeCloseTo(expected: number, precision?: any): void;
  251. toBeCloseTo(expected: number, precision: any, expectationFailOutput: any): void;
  252. toThrow(expected?: any): void;
  253. toThrowError(message?: string | RegExp): void;
  254. toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): void;
  255. toThrowMatching(predicate: (thrown: any) => boolean): void;
  256. toBeNegativeInfinity(): void;
  257. toBeNegativeInfinity(expectationFailOutput: any): void;
  258. toBePositiveInfinity(): void;
  259. toBePositiveInfinity(expectationFailOutput: any): void;
  260. toBeInstanceOf(expected: Constructor): void;
  261. toHaveClass(expected: string): void;
  262. toHaveClass(expected: string, expectationFailOutput: any): void;
  263. toHaveSize(expected: number): void;
  264. toHaveSpyInteractions(): void;
  265. withContext(message: string): Matchers<T>;
  266. not: Matchers<T>;
  267. }
  268. interface ArrayLikeMatchers<T> extends Matchers<ArrayLike<T>> {
  269. toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>): void;
  270. toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput: any): void;
  271. toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>): void;
  272. toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput: any): void;
  273. toContain(expected: Expected<T>): void;
  274. toContain(expected: Expected<T>, expectationFailOutput: any): void;
  275. withContext(message: string): ArrayLikeMatchers<T>;
  276. not: ArrayLikeMatchers<T>;
  277. }
  278. type MatchableArgs<Fn> = Fn extends (...args: infer P) => any ? {
  279. [K in keyof P]: Expected<P[K]>;
  280. } : never;
  281. interface FunctionMatchers<Fn extends Func> extends Matchers<any> {
  282. toHaveBeenCalledWith(...params: MatchableArgs<Fn>): void;
  283. toHaveBeenCalledOnceWith(...params: MatchableArgs<Fn>): void;
  284. withContext(message: string): FunctionMatchers<Fn>;
  285. not: FunctionMatchers<Fn>;
  286. }
  287. interface NothingMatcher {
  288. nothing(): void;
  289. }
  290. interface AsyncMatchers<T, U> {
  291. toBePending(): PromiseLike<void>;
  292. toBePending(expectationFailOutput: any): PromiseLike<void>;
  293. toBeResolved(): PromiseLike<void>;
  294. toBeResolved(expectationFailOutput: any): PromiseLike<void>;
  295. toBeRejected(): PromiseLike<void>;
  296. toBeRejected(expectationFailOutput: any): PromiseLike<void>;
  297. toBeResolvedTo(expected: Expected<T>): PromiseLike<void>;
  298. toBeRejectedWith(expected: Expected<U>): PromiseLike<void>;
  299. toBeRejectedWithError(expected?: new (...args: any[]) => Error, message?: string | RegExp): PromiseLike<void>;
  300. toBeRejectedWithError(message?: string | RegExp): PromiseLike<void>;
  301. withContext(message: string): AsyncMatchers<T, U>;
  302. already: AsyncMatchers<T, U>;
  303. not: AsyncMatchers<T, U>;
  304. }
  305. interface JasmineStartedInfo {
  306. totalSpecsDefined: number;
  307. order: Order;
  308. }
  309. interface CustomReportExpectation {
  310. matcherName: string;
  311. message: string;
  312. passed: boolean;
  313. stack: string;
  314. }
  315. interface FailedExpectation extends CustomReportExpectation {
  316. actual: string;
  317. expected: string;
  318. }
  319. interface PassedExpectation extends CustomReportExpectation {
  320. }
  321. interface DeprecatedExpectation {
  322. message: string;
  323. }
  324. interface SuiteResult {
  325. id: string;
  326. description: string;
  327. fullName: string;
  328. failedExpectations: FailedExpectation[];
  329. deprecationWarnings: DeprecatedExpectation[];
  330. status: string;
  331. duration: number | null;
  332. properties: {
  333. [key: string]: unknown;
  334. } | null;
  335. }
  336. interface SpecResult extends SuiteResult {
  337. passedExpectations: PassedExpectation[];
  338. pendingReason: string;
  339. debugLogs: DebugLogEntry[] | null;
  340. }
  341. interface DebugLogEntry {
  342. message: String;
  343. timestamp: number;
  344. }
  345. interface JasmineDoneInfo {
  346. overallStatus: string;
  347. totalTime: number;
  348. incompleteReason: string;
  349. order: Order;
  350. failedExpectations: ExpectationResult[];
  351. deprecationWarnings: ExpectationResult[];
  352. }
  353. type SuiteInfo = JasmineStartedInfo;
  354. type CustomReporterResult = SuiteResult & SpecResult;
  355. type RunDetails = JasmineDoneInfo;
  356. interface CustomReporter {
  357. jasmineStarted?(suiteInfo: JasmineStartedInfo, done?: () => void): void | Promise<void>;
  358. suiteStarted?(result: SuiteResult, done?: () => void): void | Promise<void>;
  359. specStarted?(result: SpecResult, done?: () => void): void | Promise<void>;
  360. specDone?(result: SpecResult, done?: () => void): void | Promise<void>;
  361. suiteDone?(result: SuiteResult, done?: () => void): void | Promise<void>;
  362. jasmineDone?(runDetails: JasmineDoneInfo, done?: () => void): void | Promise<void>;
  363. }
  364. interface SpecFilter {
  365. (spec: Spec): boolean;
  366. }
  367. type SpecFunction = (spec?: Spec) => void;
  368. interface Spec {
  369. new (attrs: any): any;
  370. readonly id: number;
  371. env: Env;
  372. readonly description: string;
  373. getFullName(): string;
  374. }
  375. interface Suite extends Spec {
  376. parentSuite: Suite;
  377. children: Array<Spec | Suite>;
  378. }
  379. interface Spy<Fn extends Func = Func> {
  380. (...params: Parameters<Fn>): ReturnType<Fn>;
  381. and: SpyAnd<Fn>;
  382. calls: Calls<Fn>;
  383. withArgs(...args: MatchableArgs<Fn>): Spy<Fn>;
  384. }
  385. type SpyObj<T> = T & {
  386. [K in keyof T]: T[K] extends Func ? T[K] & Spy<T[K]> : T[K];
  387. };
  388. function isSpy(putativeSpy: Func): putativeSpy is Spy;
  389. type NonTypedSpyObj<T> = SpyObj<{
  390. [K in keyof T]: T[K] extends Func ? Func : T[K];
  391. }>;
  392. type PromisedResolveType<T> = T extends PromiseLike<infer TResult> ? TResult : never;
  393. type PromisedRejectType<T> = T extends PromiseLike<unknown> ? any : never;
  394. interface SpyAnd<Fn extends Func> {
  395. identity: string;
  396. callThrough(): Spy<Fn>;
  397. returnValue(val: ReturnType<Fn>): Spy<Fn>;
  398. returnValues(...values: Array<ReturnType<Fn>>): Spy<Fn>;
  399. callFake(fn: Fn): Spy<Fn>;
  400. resolveTo(val?: PromisedResolveType<ReturnType<Fn>>): Spy<Fn>;
  401. rejectWith(val?: PromisedRejectType<ReturnType<Fn>>): Spy<Fn>;
  402. throwError(msg: string | Error): Spy;
  403. stub(): Spy;
  404. }
  405. interface Calls<Fn extends Func> {
  406. any(): boolean;
  407. count(): number;
  408. argsFor(index: number): Parameters<Fn>;
  409. allArgs(): ReadonlyArray<Parameters<Fn>>;
  410. all(): ReadonlyArray<CallInfo<Fn>>;
  411. mostRecent(): CallInfo<Fn>;
  412. first(): CallInfo<Fn>;
  413. reset(): void;
  414. saveArgumentsByValue(): void;
  415. thisFor(index: number): ThisType<Fn>;
  416. }
  417. interface CallInfo<Fn extends Func> {
  418. object: ThisType<Fn>;
  419. args: Parameters<Fn>;
  420. returnValue: ReturnType<Fn>;
  421. }
  422. interface Util {
  423. inherit(childClass: Function, parentClass: Function): any;
  424. formatException(e: any): any;
  425. htmlEscape(str: string): string;
  426. argsToArray(args: any): any;
  427. extend(destination: any, source: any): any;
  428. }
  429. interface JsApiReporter extends CustomReporter {
  430. new (): any;
  431. started: boolean;
  432. finished: boolean;
  433. runDetails: JasmineDoneInfo;
  434. status(): string;
  435. suiteResults(index: number, length: number): SuiteResult[];
  436. specResults(index: number, length: number): SpecResult[];
  437. suites(): {
  438. [id: string]: SuiteResult;
  439. };
  440. specs(): SpecResult[];
  441. executionTime(): number;
  442. }
  443. interface Jasmine {
  444. Spec: Spec;
  445. clock: Clock;
  446. util: Util;
  447. }
  448. var HtmlReporter: HtmlReporter;
  449. var HtmlSpecFilter: HtmlSpecFilter;
  450. var DEFAULT_TIMEOUT_INTERVAL: number;
  451. var MAX_PRETTY_PRINT_ARRAY_LENGTH: number;
  452. var MAX_PRETTY_PRINT_CHARS: number;
  453. var MAX_PRETTY_PRINT_DEPTH: number;
  454. var version: string;
  455. interface JasmineOptions {
  456. projectBaseDir?: string;
  457. }
  458. interface JasmineConfig {
  459. failSpecWithNoExpectations?: boolean;
  460. helpers?: string[];
  461. jsLoader?: "require" | "import";
  462. random?: boolean;
  463. requires?: string[];
  464. spec_dir?: string;
  465. spec_files?: string[];
  466. stopOnSpecFailure?: boolean;
  467. stopSpecOnExpectationFailure?: boolean;
  468. }
  469. interface DefaultReporterOptions {
  470. timer?: any;
  471. print?: (...args: any[]) => void;
  472. showColors?: boolean;
  473. jasmineCorePath?: string;
  474. }
  475. }
  476. declare module "jasmine" {
  477. class jasmine {
  478. jasmine: jasmine.Jasmine;
  479. env: jasmine.Env;
  480. reportersCount: number;
  481. reporter: jasmine.CustomReporter;
  482. showingColors: boolean;
  483. projectBaseDir: string;
  484. specDir: string;
  485. specFiles: string[];
  486. helperFiles: string[];
  487. requires: string[];
  488. defaultReporterConfigured: boolean;
  489. constructor(options?: jasmine.JasmineOptions);
  490. addMatchers(matchers: jasmine.CustomMatcherFactories): void;
  491. addReporter(reporter: jasmine.CustomReporter): void;
  492. addSpecFile(filePath: string): void;
  493. addMatchingSpecFiles(patterns: string[]): void;
  494. addHelperFile(filePath: string): void;
  495. addMatchingHelperFiles(patterns: string[]): void;
  496. addRequires(files: string[]): void;
  497. configureDefaultReporter(options: jasmine.DefaultReporterOptions): void;
  498. execute(files?: string[], filterString?: string): Promise<jasmine.JasmineDoneInfo>;
  499. exitOnCompletion: boolean;
  500. loadConfig(config: jasmine.JasmineConfig): void;
  501. loadConfigFile(configFilePath?: string): void;
  502. loadHelpers(): Promise<void>;
  503. loadSpecs(): Promise<void>;
  504. loadRequires(): void;
  505. provideFallbackReporter(reporter: jasmine.CustomReporter): void;
  506. clearReporters(): void;
  507. randomizeTests(value: boolean): void;
  508. seed(value: number): void;
  509. showColors(value: boolean): void;
  510. stopSpecOnExpectationFailure(value: boolean): void;
  511. stopOnSpecFailure(value: boolean): void;
  512. static ConsoleReporter(): any;
  513. coreVersion(): string;
  514. }
  515. export = jasmine;
  516. }