UNPKG

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