UNPKG

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