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