1 | // Type definitions for karma 6.3
|
2 | // Project: https://github.com/karma-runner/karma, http://karma-runner.github.io
|
3 | // Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
4 | // James Garbutt <https://github.com/43081j>
|
5 | // Yaroslav Admin <https://github.com/devoto13>
|
6 | // Piotr Błażejewicz <https://github.com/peterblazejewicz>
|
7 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
8 | // TypeScript Version: 3.2
|
9 |
|
10 | /// <reference types="node" />
|
11 |
|
12 | // See Karma public API https://karma-runner.github.io/latest/dev/public-api.html
|
13 | import https = require("https");
|
14 | import { Appender } from "log4js";
|
15 | import { EventEmitter } from "events";
|
16 | import * as constants from "./lib/constants";
|
17 | import { VERSION } from "./lib/constants";
|
18 |
|
19 | export { constants, VERSION };
|
20 | export const runner: Runner;
|
21 | export const stopper: Stopper;
|
22 |
|
23 | export namespace launcher {
|
24 | class Launcher {
|
25 | static generateId(): string;
|
26 |
|
27 | constructor(emitter: NodeJS.EventEmitter, injector: any);
|
28 |
|
29 | // TODO: Can this return value ever be typified?
|
30 | launch(names: string[], protocol: string, hostname: string, port: number, urlRoot: string): any[];
|
31 | kill(id: string, callback: () => void): boolean;
|
32 | restart(id: string): boolean;
|
33 | killAll(callback: () => void): void;
|
34 | areAllCaptured(): boolean;
|
35 | markCaptured(id: string): void;
|
36 | }
|
37 | }
|
38 |
|
39 | export interface Runner {
|
40 | run(options?: Config, callback?: ServerCallback): void;
|
41 | /** @deprecated */
|
42 | // tslint:disable-next-line:unified-signatures to correctly show deprecated overload
|
43 | run(options?: ConfigOptions | ConfigFile, callback?: ServerCallback): void;
|
44 | }
|
45 |
|
46 | export interface Stopper {
|
47 | /**
|
48 | * This function will signal a running server to stop. The equivalent of karma stop.
|
49 | */
|
50 | stop(options?: Config, callback?: ServerCallback): void;
|
51 | /** @deprecated */
|
52 | // tslint:disable-next-line:unified-signatures to correctly show deprecated overload
|
53 | stop(options?: ConfigOptions, callback?: ServerCallback): void;
|
54 | }
|
55 |
|
56 | export interface TestResults {
|
57 | disconnected: boolean;
|
58 | error: boolean;
|
59 | exitCode: number;
|
60 | failed: number;
|
61 | success: number;
|
62 | }
|
63 |
|
64 | export class Server extends EventEmitter {
|
65 | constructor(options?: Config, callback?: ServerCallback);
|
66 | /** @deprecated */
|
67 | // tslint:disable-next-line:unified-signatures to correctly show deprecated overload
|
68 | constructor(options?: ConfigOptions | ConfigFile, callback?: ServerCallback);
|
69 | /**
|
70 | * Start the server
|
71 | */
|
72 | start(): Promise<void>;
|
73 |
|
74 | /**
|
75 | * Stop the server
|
76 | */
|
77 | stop(): Promise<void>;
|
78 |
|
79 | /**
|
80 | * Get properties from the injector
|
81 | * @param token
|
82 | */
|
83 | get(token: string): any;
|
84 |
|
85 | /**
|
86 | * Force a refresh of the file list
|
87 | */
|
88 | refreshFiles(): Promise<any>;
|
89 |
|
90 | on(event: string, listener: (...args: any[]) => void): this;
|
91 |
|
92 | /**
|
93 | * Listen to the 'run_complete' event.
|
94 | */
|
95 | on(event: "run_complete", listener: (browsers: any, results: TestResults) => void): this;
|
96 | }
|
97 |
|
98 | export type ServerCallback = (exitCode: number) => void;
|
99 |
|
100 | export interface Config {
|
101 | set: (config: ConfigOptions) => void;
|
102 | LOG_DISABLE: string;
|
103 | LOG_ERROR: string;
|
104 | LOG_WARN: string;
|
105 | LOG_INFO: string;
|
106 | LOG_DEBUG: string;
|
107 | }
|
108 |
|
109 | export interface ConfigFile {
|
110 | configFile: string;
|
111 | }
|
112 |
|
113 | // For documentation and intellisense list Karma browsers
|
114 |
|
115 | /**
|
116 | * Available browser launchers
|
117 | * - `Chrome` - launcher requires `karma-chrome-launcher` plugin
|
118 | * - `ChromeCanary` - launcher requires `karma-chrome-launcher` plugin
|
119 | * - `ChromeHeadless` - launcher requires `karma-chrome-launcher` plugin
|
120 | * - `PhantomJS` - launcher requires `karma-phantomjs-launcher` plugin
|
121 | * - `Firefox` - launcher requires `karma-firefox-launcher` plugin
|
122 | * - `FirefoxHeadless` - launcher requires `karma-firefox-launcher` plugin
|
123 | * - `FirefoxDeveloper` - launcher requires `karma-firefox-launcher` plugin
|
124 | * - `FirefoxDeveloperHeadless` - launcher requires `karma-firefox-launcher` plugin
|
125 | * - `FirefoxAurora` - launcher requires `karma-firefox-launcher` plugin
|
126 | * - `FirefoxAuroraHeadless` - launcher requires `karma-firefox-launcher` plugin
|
127 | * - `FirefoxNightly` - launcher requires `karma-firefox-launcher` plugin
|
128 | * - `FirefoxNightlyHeadless` - launcher requires `karma-firefox-launcher` plugin
|
129 | * - `Opera` - launcher requires `karma-opera-launcher` plugin
|
130 | * - `IE` - launcher requires `karma-ie-launcher` plugin
|
131 | * - `Safari` - launcher requires karma-safari-launcher plugin
|
132 | */
|
133 | export type AutomatedBrowsers =
|
134 | | "Chrome"
|
135 | | "ChromeCanary"
|
136 | | "ChromeHeadless"
|
137 | | "PhantomJS"
|
138 | | "Firefox"
|
139 | | "FirefoxHeadless"
|
140 | | "FirefoxDeveloper"
|
141 | | "FirefoxDeveloperHeadless"
|
142 | | "FirefoxAurora"
|
143 | | "FirefoxAuroraHeadless"
|
144 | | "FirefoxNightly"
|
145 | | "FirefoxNightlyHeadless"
|
146 | | "Opera"
|
147 | | "IE"
|
148 | | "Safari";
|
149 |
|
150 | export interface CustomHeaders {
|
151 | /** Regular expression string to match files */
|
152 | match: string;
|
153 | /** HTTP header name */
|
154 | name: string;
|
155 | /** HTTP header value */
|
156 | value: string;
|
157 | }
|
158 |
|
159 | export interface ProxyOptions {
|
160 | /** The target url or path (mandatory) */
|
161 | target: string;
|
162 | /**
|
163 | * Whether or not the proxy should override the Host header using the host from the target
|
164 | * @defult false
|
165 | */
|
166 | changeOrigin?: boolean | undefined;
|
167 | }
|
168 |
|
169 | /** A map of path-proxy pairs. */
|
170 | export interface PathProxyPairs {
|
171 | [path: string]: string | ProxyOptions;
|
172 | }
|
173 |
|
174 | /** For use when the Karma server needs to be run behind a proxy that changes the base url, etc */
|
175 | export interface UpstreamProxy {
|
176 | /**
|
177 | * Will be prepended to the base url when launching browsers and prepended to internal urls as loaded by the browsers
|
178 | * @default '/'
|
179 | */
|
180 | path?: string | undefined;
|
181 | /**
|
182 | * Will be used as the port when launching browsers
|
183 | * @default 9875
|
184 | */
|
185 | port?: number | undefined;
|
186 | /**
|
187 | * Will be used as the hostname when launching browsers
|
188 | * @default 'localhost'
|
189 | */
|
190 | hostname?: string | undefined;
|
191 | /**
|
192 | * Will be used as the protocol when launching browsers
|
193 | * @default 'http'
|
194 | */
|
195 | protocol?: string | undefined;
|
196 | }
|
197 |
|
198 | // description of inline plugins
|
199 | export type PluginName = string;
|
200 | // tslint:disable-next-line:ban-types support for constructor function and classes
|
201 | export type ConstructorFn = Function | (new (...params: any[]) => any);
|
202 | export type FactoryFn = (...params: any[]) => any;
|
203 | export type ConstructorFnType = ["type", ConstructorFn];
|
204 | export type FactoryFnType = ["factory", FactoryFn];
|
205 | export type ValueType = ["value", any];
|
206 | export type InlinePluginType = FactoryFnType | ConstructorFnType | ValueType;
|
207 | export type InlinePluginDef = Record<PluginName, InlinePluginType>;
|
208 |
|
209 | export interface ConfigOptions {
|
210 | /**
|
211 | * @description Enable or disable watching files and executing the tests whenever one of these files changes.
|
212 | * @default true
|
213 | */
|
214 | autoWatch?: boolean | undefined;
|
215 | /**
|
216 | * @description When Karma is watching the files for changes, it tries to batch multiple changes into a single run
|
217 | * so that the test runner doesn't try to start and restart running tests more than it should.
|
218 | * The configuration setting tells Karma how long to wait (in milliseconds) after any changes have occurred
|
219 | * before starting the test process again.
|
220 | * @default 250
|
221 | */
|
222 | autoWatchBatchDelay?: number | undefined;
|
223 | /**
|
224 | * @default ''
|
225 | * @description The root path location that will be used to resolve all relative paths defined in <code>files</code> and <code>exclude</code>.
|
226 | * If the basePath configuration is a relative path then it will be resolved to
|
227 | * the <code>__dirname</code> of the configuration file.
|
228 | */
|
229 | basePath?: string | undefined;
|
230 | /**
|
231 | * Configure how the browser console is logged with the following properties, all of which are optional
|
232 | */
|
233 | browserConsoleLogOptions?: BrowserConsoleLogOptions | undefined;
|
234 | /**
|
235 | * @default 2000
|
236 | * @description How long does Karma wait for a browser to reconnect (in ms).
|
237 | * <p>
|
238 | * With a flaky connection it is pretty common that the browser disconnects,
|
239 | * but the actual test execution is still running without any problems. Karma does not treat a disconnection
|
240 | * as immediate failure and will wait <code>browserDisconnectTimeout</code> (ms).
|
241 | * If the browser reconnects during that time, everything is fine.
|
242 | * </p>
|
243 | */
|
244 | browserDisconnectTimeout?: number | undefined;
|
245 | /**
|
246 | * @default 0
|
247 | * @description The number of disconnections tolerated.
|
248 | * <p>
|
249 | * The <code>disconnectTolerance</code> value represents the maximum number of tries a browser will attempt
|
250 | * in the case of a disconnection. Usually any disconnection is considered a failure,
|
251 | * but this option allows you to define a tolerance level when there is a flaky network link between
|
252 | * the Karma server and the browsers.
|
253 | * </p>
|
254 | */
|
255 | browserDisconnectTolerance?: number | undefined;
|
256 | /**
|
257 | * @default 10000
|
258 | * @description How long will Karma wait for a message from a browser before disconnecting from it (in ms).
|
259 | * <p>
|
260 | * If, during test execution, Karma does not receive any message from a browser within
|
261 | * <code>browserNoActivityTimeout</code> (ms), it will disconnect from the browser
|
262 | * </p>
|
263 | */
|
264 | browserNoActivityTimeout?: number | undefined;
|
265 | /**
|
266 | * Timeout for the client socket connection (in ms)
|
267 | * @default 20000
|
268 | */
|
269 | browserSocketTimeout?: number | undefined;
|
270 | /**
|
271 | * @default []
|
272 | * Possible Values:
|
273 | * <ul>
|
274 | * <li>Chrome (launcher comes installed with Karma)</li>
|
275 | * <li>ChromeCanary (launcher comes installed with Karma)</li>
|
276 | * <li>PhantomJS (launcher comes installed with Karma)</li>
|
277 | * <li>Firefox (launcher requires karma-firefox-launcher plugin)</li>
|
278 | * <li>FirefoxHeadless (launcher requires karma-firefox-launcher plugin)</li>
|
279 | * <li>FirefoxDeveloper (launcher requires karma-firefox-launcher plugin)</li>
|
280 | * <li>FirefoxDeveloperHeadless (launcher requires karma-firefox-launcher plugin)</li>
|
281 | * <li>FirefoxAurora (launcher requires karma-firefox-launcher plugin)</li>
|
282 | * <li>FirefoxAuroraHeadless (launcher requires karma-firefox-launcher plugin)</li>
|
283 | * <li>FirefoxNightly (launcher requires karma-firefox-launcher plugin)</li>
|
284 | * <li>FirefoxNightlyHeadless (launcher requires karma-firefox-launcher plugin)</li>
|
285 | * <li>Opera (launcher requires karma-opera-launcher plugin)</li>
|
286 | * <li>Internet Explorer (launcher requires karma-ie-launcher plugin)</li>
|
287 | * <li>Safari (launcher requires karma-safari-launcher plugin)</li>
|
288 | * </ul>
|
289 | * @description A list of browsers to launch and capture. When Karma starts up, it will also start up each browser
|
290 | * which is placed within this setting. Once Karma is shut down, it will shut down these browsers as well.
|
291 | * You can capture any browser manually by opening the browser and visiting the URL where
|
292 | * the Karma web server is listening (by default it is <code>http://localhost:9876/</code>).
|
293 | */
|
294 | browsers?: Array<AutomatedBrowsers | string> | undefined;
|
295 | /**
|
296 | * @default 60000
|
297 | * @description Timeout for capturing a browser (in ms).
|
298 | * <p>
|
299 | * The <code>captureTimeout</code> value represents the maximum boot-up time allowed for a
|
300 | * browser to start and connect to Karma. If any browser does not get captured within the timeout, Karma
|
301 | * will kill it and try to launch it again and, after three attempts to capture it, Karma will give up.
|
302 | * </p>
|
303 | */
|
304 | captureTimeout?: number | undefined;
|
305 | client?: ClientOptions | undefined;
|
306 | /**
|
307 | * @default true
|
308 | * @description Enable or disable colors in the output (reporters and logs).
|
309 | */
|
310 | colors?: boolean | undefined;
|
311 | /**
|
312 | * @default 'Infinity'
|
313 | * @description How many browsers Karma launches in parallel.
|
314 | * Especially on services like SauceLabs and Browserstack, it makes sense only to launch a limited
|
315 | * amount of browsers at once, and only start more when those have finished. Using this configuration,
|
316 | * you can specify how many browsers should be running at once at any given point in time.
|
317 | */
|
318 | concurrency?: number | undefined;
|
319 | /**
|
320 | * When true, this will append the crossorigin attribute to generated script tags,
|
321 | * which enables better error reporting for JavaScript files served from a different origin
|
322 | * @default true
|
323 | */
|
324 | crossOriginAttribute?: boolean | undefined;
|
325 | /**
|
326 | * If null (default), uses karma's own context.html file.
|
327 | * @default undefined
|
328 | */
|
329 | customContextFile?: string | undefined;
|
330 | /**
|
331 | * If null (default), uses karma's own client_with_context.html file (which is used when client.runInParent set to true).
|
332 | * @default undefined
|
333 | */
|
334 | customClientContextFile?: string | undefined;
|
335 | /**
|
336 | * If null (default), uses karma's own debug.html file.
|
337 | * @default undefined
|
338 | */
|
339 | customDebugFile?: string | undefined;
|
340 | /**
|
341 | * Custom HTTP headers that will be set upon serving files by Karma's web server.
|
342 | * Custom headers are useful, especially with upcoming browser features like Service Workers.
|
343 | * @default undefined
|
344 | */
|
345 | customHeaders?: CustomHeaders[] | undefined;
|
346 | customLaunchers?: { [key: string]: CustomLauncher } | undefined;
|
347 | /**
|
348 | * When true, this will start the karma server in another process, writing no output to the console.
|
349 | * The server can be stopped using the karma stop command.
|
350 | * @default false
|
351 | */
|
352 | detached?: boolean | undefined;
|
353 | /**
|
354 | * @default []
|
355 | * @description List of files/patterns to exclude from loaded files.
|
356 | */
|
357 | exclude?: string[] | undefined;
|
358 | /**
|
359 | * Enable or disable failure on running empty test-suites.
|
360 | * If disabled the program will return exit-code 0 and display a warning.
|
361 | * @default true
|
362 | */
|
363 | failOnEmptyTestSuite?: boolean | undefined;
|
364 | /**
|
365 | * Enable or disable failure on tests deliberately disabled, eg fit() or xit() tests in jasmine.
|
366 | * Use this to prevent accidental disabling tests needed to validate production.
|
367 | * @default true
|
368 | */
|
369 | failOnSkippedTests?: boolean | undefined;
|
370 | /**
|
371 | * Enable or disable failure on failing tests.
|
372 | * @default true
|
373 | */
|
374 | failOnFailingTestSuite?: boolean | undefined;
|
375 | /**
|
376 | * @default []
|
377 | * @description List of files/patterns to load in the browser.
|
378 | */
|
379 | files?: Array<FilePattern | string> | undefined;
|
380 | /**
|
381 | * Force socket.io to use JSONP polling instead of XHR polling
|
382 | * @default false
|
383 | */
|
384 | forceJSONP?: boolean | undefined;
|
385 | /**
|
386 | * A new error message line
|
387 | * @default undefined
|
388 | */
|
389 | formatError?: ((msg: string) => string) | undefined;
|
390 | /**
|
391 | * @default []
|
392 | * @description List of test frameworks you want to use. Typically, you will set this to ['jasmine'], ['mocha'] or ['qunit']...
|
393 | * Please note just about all frameworks in Karma require an additional plugin/framework library to be installed (via NPM).
|
394 | */
|
395 | frameworks?: string[] | undefined;
|
396 | /**
|
397 | * @default 'localhost'
|
398 | * @description Hostname to be used when capturing browsers.
|
399 | */
|
400 | hostname?: string | undefined;
|
401 | /**
|
402 | * Module used for Karma webserver
|
403 | * @default undefined
|
404 | */
|
405 | httpModule?: string | undefined;
|
406 | /**
|
407 | * @default {}
|
408 | * @description Options object to be used by Node's https class.
|
409 | * Object description can be found in the
|
410 | * [NodeJS.org API docs](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener)
|
411 | */
|
412 | httpsServerOptions?: https.ServerOptions | undefined;
|
413 | /**
|
414 | * Address that the server will listen on. Change to 'localhost' to only listen to the loopback, or '::' to listen on all IPv6 interfaces
|
415 | * @default '0.0.0.0' or `LISTEN_ADDR`
|
416 | */
|
417 | listenAddress?: string | undefined;
|
418 | /**
|
419 | * @default config.LOG_INFO
|
420 | * Possible values:
|
421 | * <ul>
|
422 | * <li>config.LOG_DISABLE</li>
|
423 | * <li>config.LOG_ERROR</li>
|
424 | * <li>config.LOG_WARN</li>
|
425 | * <li>config.LOG_INFO</li>
|
426 | * <li>config.LOG_DEBUG</li>
|
427 | * </ul>
|
428 | * @description Level of logging.
|
429 | */
|
430 | logLevel?: string | undefined;
|
431 | /**
|
432 | * @default [{type: 'console'}]
|
433 | * @description A list of log appenders to be used. See the documentation for [log4js] for more information.
|
434 | */
|
435 | loggers?: { [name: string]: Appender } | Appender[] | undefined;
|
436 | /**
|
437 | * @default []
|
438 | * @description List of names of additional middleware you want the
|
439 | * Karma server to use. Middleware will be used in the order listed.
|
440 | * You must have installed the middleware via a plugin/framework
|
441 | * (either inline or via NPM). Additional information can be found in
|
442 | * [plugins](http://karma-runner.github.io/2.0/config/plugins.html).
|
443 | * The plugin must provide an express/connect middleware function
|
444 | * (details about this can be found in the
|
445 | * [Express](http://expressjs.com/guide/using-middleware.html) docs).
|
446 | */
|
447 | middleware?: string[] | undefined;
|
448 | /**
|
449 | * This is the same as middleware except that these middleware will be run before karma's own middleware.
|
450 | * @default []
|
451 | */
|
452 | beforeMiddleware?: string[] | undefined;
|
453 | /**
|
454 | * @default {}
|
455 | * @description Redefine default mapping from file extensions to MIME-type.
|
456 | * Set property name to required MIME, provide Array of extensions (without dots) as it's value.
|
457 | */
|
458 | mime?: { [type: string]: string[] } | undefined;
|
459 | /**
|
460 | * Socket.io pingTimeout in ms, https://socket.io/docs/server-api/#new-Server-httpServer-options.
|
461 | * Very slow networks may need values up to 60000. Larger values delay discovery of deadlock in tests or browser crashes.
|
462 | * @default 5000
|
463 | */
|
464 | pingTimeout?: number | undefined;
|
465 | /**
|
466 | * @default ['karma-*']
|
467 | * @description List of plugins to load. A plugin can be a string (in which case it will be required
|
468 | * by Karma) or an inlined plugin - Object.
|
469 | * By default, Karma loads all sibling NPM modules which have a name starting with karma-*.
|
470 | * Note: Just about all plugins in Karma require an additional library to be installed (via NPM).
|
471 | */
|
472 | plugins?: Array<PluginName | InlinePluginDef> | undefined;
|
473 | /**
|
474 | * @default 9876
|
475 | * @description The port where the web server will be listening.
|
476 | */
|
477 | port?: number | undefined;
|
478 | /**
|
479 | * How long will Karma wait for browser process to terminate before sending a SIGKILL signal
|
480 | * @default 2000
|
481 | */
|
482 | processKillTimeout?: number | undefined;
|
483 | /**
|
484 | * @default {'**\/*.coffee': 'coffee'}
|
485 | * @description A map of preprocessors to use.
|
486 | *
|
487 | * Preprocessors can be loaded through [plugins].
|
488 | *
|
489 | * Note: Just about all preprocessors in Karma (other than CoffeeScript and some other defaults)
|
490 | * require an additional library to be installed (via NPM).
|
491 | *
|
492 | * Be aware that preprocessors may be transforming the files and file types that are available at run time. For instance,
|
493 | * if you are using the "coverage" preprocessor on your source files, if you then attempt to interactively debug
|
494 | * your tests, you'll discover that your expected source code is completely changed from what you expected. Because
|
495 | * of that, you'll want to engineer this so that your automated builds use the coverage entry in the "reporters" list,
|
496 | * but your interactive debugging does not.
|
497 | *
|
498 | */
|
499 | preprocessors?: { [name: string]: string | string[] } | undefined;
|
500 | /**
|
501 | * @default 'http:'
|
502 | * Possible Values:
|
503 | * <ul>
|
504 | * <li>http:</li>
|
505 | * <li>https:</li>
|
506 | * </ul>
|
507 | * @description Protocol used for running the Karma webserver.
|
508 | * Determines the use of the Node http or https class.
|
509 | * Note: Using <code>'https:'</code> requires you to specify <code>httpsServerOptions</code>.
|
510 | */
|
511 | protocol?: string | undefined;
|
512 | /**
|
513 | * @default {}
|
514 | * @description A map of path-proxy pairs
|
515 | * The proxy can be specified directly by the target url or path, or with an object to configure more options
|
516 | */
|
517 | proxies?: PathProxyPairs | undefined;
|
518 | /**
|
519 | * Called when requesting Proxy
|
520 | * @default undefined
|
521 | */
|
522 | proxyReq?: ((proxyReq: any, req: any, res: any, options: object) => void) | undefined;
|
523 | /**
|
524 | * Called when respnsing Proxy
|
525 | * @default undefined
|
526 | */
|
527 | proxyRes?: ((proxyRes: any, req: any, res: any) => void) | undefined;
|
528 | /**
|
529 | * @default true
|
530 | * @description Whether or not Karma or any browsers should raise an error when an inavlid SSL certificate is found.
|
531 | */
|
532 | proxyValidateSSL?: boolean | undefined;
|
533 | /**
|
534 | * @default 0
|
535 | * @description Karma will report all the tests that are slower than given time limit (in ms).
|
536 | * This is disabled by default (since the default value is 0).
|
537 | */
|
538 | reportSlowerThan?: number | undefined;
|
539 | /**
|
540 | * @default ['progress']
|
541 | * Possible Values:
|
542 | * <ul>
|
543 | * <li>dots</li>
|
544 | * <li>progress</li>
|
545 | * </ul>
|
546 | * @description A list of reporters to use.
|
547 | * Additional reporters, such as growl, junit, teamcity or coverage can be loaded through plugins.
|
548 | * Note: Just about all additional reporters in Karma (other than progress) require an additional library to be installed (via NPM).
|
549 | */
|
550 | reporters?: string[] | undefined;
|
551 | /**
|
552 | * When Karma is watching the files for changes, it will delay a new run
|
553 | * until the current run is finished. Enabling this setting
|
554 | * will cancel the current run and start a new run immediately when a change is detected.
|
555 | */
|
556 | restartOnFileChange?: boolean | undefined;
|
557 | /**
|
558 | * When a browser crashes, karma will try to relaunch. This defines how many times karma should relaunch a browser before giving up.
|
559 | * @default 2
|
560 | */
|
561 | retryLimit?: number | undefined;
|
562 | /**
|
563 | * @default false
|
564 | * @description Continuous Integration mode.
|
565 | * If true, Karma will start and capture all configured browsers, run tests and then exit with an exit code of 0 or 1 depending
|
566 | * on whether all tests passed or any tests failed.
|
567 | */
|
568 | singleRun?: boolean | undefined;
|
569 | /**
|
570 | * @default ['polling', 'websocket']
|
571 | * @description An array of allowed transport methods between the browser and testing server. This configuration setting
|
572 | * is handed off to [socket.io](http://socket.io/) (which manages the communication
|
573 | * between browsers and the testing server).
|
574 | */
|
575 | transports?: string[] | undefined;
|
576 | /**
|
577 | * For use when the Karma server needs to be run behind a proxy that changes the base url, etc
|
578 | */
|
579 | upstreamProxy?: UpstreamProxy | undefined;
|
580 | /**
|
581 | * @default '/'
|
582 | * @description The base url, where Karma runs.
|
583 | * All of Karma's urls get prefixed with the urlRoot. This is helpful when using proxies, as
|
584 | * sometimes you might want to proxy a url that is already taken by Karma.
|
585 | */
|
586 | urlRoot?: string | undefined;
|
587 | }
|
588 |
|
589 | export interface ClientOptions {
|
590 | /**
|
591 | * @default undefined
|
592 | * @description When karma run is passed additional arguments on the command-line, they
|
593 | * are passed through to the test adapter as karma.config.args (an array of strings).
|
594 | * The client.args option allows you to set this value for actions other than run.
|
595 | * How this value is used is up to your test adapter - you should check your adapter's
|
596 | * documentation to see how (and if) it uses this value.
|
597 | */
|
598 | args?: string[] | undefined;
|
599 | /**
|
600 | * @default false
|
601 | * @description Set style display none on client elements.
|
602 | * If true, Karma does not display the banner and browser list.
|
603 | * Useful when using karma on component tests with screenshots
|
604 | */
|
605 | clientDisplayNone?: boolean | undefined;
|
606 | /**
|
607 | * @default true
|
608 | * @description Run the tests inside an iFrame or a new window
|
609 | * If true, Karma runs the tests inside an iFrame. If false, Karma runs the tests in a new window. Some tests may not run in an
|
610 | * iFrame and may need a new window to run.
|
611 | */
|
612 | useIframe?: boolean | undefined;
|
613 | /**
|
614 | * @default true
|
615 | * @description Capture all console output and pipe it to the terminal.
|
616 | */
|
617 | captureConsole?: boolean | undefined;
|
618 | /**
|
619 | * @default false
|
620 | * @description Run the tests on the same window as the client, without using iframe or a new window
|
621 | */
|
622 | runInParent?: boolean | undefined;
|
623 | /**
|
624 | * @default true
|
625 | * @description Clear the context window
|
626 | * If true, Karma clears the context window upon the completion of running the tests.
|
627 | * If false, Karma does not clear the context window upon the completion of running the tests.
|
628 | * Setting this to false is useful when embedding a Jasmine Spec Runner Template.
|
629 | */
|
630 | clearContext?: boolean | undefined;
|
631 | }
|
632 |
|
633 | /** type to use when including a file */
|
634 | export type FilePatternTypes = "css" | "html" | "js" | "module" | "dom";
|
635 |
|
636 | export interface FilePattern {
|
637 | /**
|
638 | * The pattern to use for matching.
|
639 | */
|
640 | pattern: string;
|
641 | /**
|
642 | * @default true
|
643 | * @description If <code>autoWatch</code> is true all files that have set watched to true will be watched
|
644 | * for changes.
|
645 | */
|
646 | watched?: boolean | undefined;
|
647 | /**
|
648 | * @default true
|
649 | * @description Should the files be included in the browser using <script> tag? Use false if you want to
|
650 | * load them manually, eg. using Require.js.
|
651 | */
|
652 | included?: boolean | undefined;
|
653 | /**
|
654 | * @default true
|
655 | * @description Should the files be served by Karma's webserver?
|
656 | */
|
657 | served?: boolean | undefined;
|
658 | /**
|
659 | * Choose the type to use when including a file
|
660 | * @default 'js'
|
661 | * @description The type determines the mechanism for including the file.
|
662 | * The css and html types create link elements; the js and module elements create script elements.
|
663 | * The dom type includes the file content in the page, used, for example, to test components combining HTML and JS.
|
664 | */
|
665 | type?: FilePatternTypes | undefined;
|
666 | /**
|
667 | * @default false
|
668 | * @description Should the files be served from disk on each request by Karma's webserver?
|
669 | */
|
670 | nocache?: boolean | undefined;
|
671 | }
|
672 |
|
673 | export interface CustomLauncher {
|
674 | base: string;
|
675 | browserName?: string | undefined;
|
676 | flags?: string[] | undefined;
|
677 | platform?: string | undefined;
|
678 | }
|
679 |
|
680 | export interface BrowserConsoleLogOptions {
|
681 | /** the desired log-level, where level log always is logged */
|
682 | level?: "log" | "error" | "warn" | "info" | "debug" | undefined;
|
683 | /**
|
684 | * The format is a string where `%b`, `%t`, `%T`, and `%m` are replaced with the browser string,
|
685 | * log type in lower-case, log type in uppercase, and log message, respectively.
|
686 | * This format will only effect the output file
|
687 | */
|
688 | format?: string | undefined;
|
689 | /** output-path of the output-file */
|
690 | path?: string | undefined;
|
691 | /** if the log should be written in the terminal, or not */
|
692 | terminal?: boolean | undefined;
|
693 | }
|
694 |
|
695 | interface ParseOptions {
|
696 | /**
|
697 | * When true, the return value of the function is a Promise of Config instead of Config.
|
698 | * Should be set to true to support async Karma configuration file.
|
699 | *
|
700 | * @deprecated Will become a default in the next major release.
|
701 | */
|
702 | promiseConfig?: boolean | undefined;
|
703 |
|
704 | /**
|
705 | * When true, function will throw error or return rejected Promise instead of calling process.exit(1).
|
706 | *
|
707 | * @deprecated Will become a default in the next major release.
|
708 | */
|
709 | throwErrors?: boolean | undefined;
|
710 | }
|
711 |
|
712 | export namespace config {
|
713 | function parseConfig(configFilePath: string, cliOptions: ConfigOptions): Config;
|
714 | function parseConfig(
|
715 | configFilePath: string | null | undefined,
|
716 | cliOptions: ConfigOptions,
|
717 | parseOptions?: ParseOptions & { promiseConfig: true },
|
718 | ): Promise<Config>;
|
719 | function parseConfig(
|
720 | configFilePath: string | null | undefined,
|
721 | cliOptions: ConfigOptions,
|
722 | parseOptions?: ParseOptions,
|
723 | ): Config;
|
724 | }
|
725 |
|
\ | No newline at end of file |