From 80c2f3dd1202e234af247afb0b7f9e5eaaa2789d Mon Sep 17 00:00:00 2001 From: Yaroslav Admin Date: Tue, 27 Nov 2018 21:29:37 +0100 Subject: [PATCH] Eliminated obsolete namespace wrapper See https://github.com/Microsoft/dtslint/blob/master/docs/export-just-namespace.md --- types/karma/index.d.ts | 896 ++++++++++++++++++++--------------------- 1 file changed, 446 insertions(+), 450 deletions(-) diff --git a/types/karma/index.d.ts b/types/karma/index.d.ts index 09b263e104..0da2803283 100644 --- a/types/karma/index.d.ts +++ b/types/karma/index.d.ts @@ -13,464 +13,460 @@ import Promise = require('bluebird'); import https = require('https'); import { Appender } from 'log4js'; -declare namespace karma { - /** - * `start` method is deprecated since 0.13. It will be removed in 0.14. - * Please use - * - * server = new Server(config, [done]) - * server.start() - * - * instead. - * - * @deprecated - */ - const server: DeprecatedServer; +/** + * `start` method is deprecated since 0.13. It will be removed in 0.14. + * Please use + * + * server = new Server(config, [done]) + * server.start() + * + * instead. + * + * @deprecated + */ +export const server: DeprecatedServer; - const runner: Runner; - const stopper: Stopper; +export const runner: Runner; +export const stopper: Stopper; - const VERSION: string; - const constants: Constants; +export const VERSION: string; +export const constants: Constants; - interface Constants { - VERSION: string; - DEFAULT_PORT: number; - DEFAULT_HOSTNAME: string; - DEFAULT_LISTEN_ADDR: string; - LOG_DISABLE: string; - LOG_ERROR: string; - LOG_WARN: string; - LOG_INFO: string; - LOG_DEBUG: string; - LOG_LOG: string; - LOG_PRIORITIES: string[]; - COLOR_PATTERN: string; - NO_COLOR_PATTERN: string; - CONSOLE_APPENDER: { +export interface Constants { + VERSION: string; + DEFAULT_PORT: number; + DEFAULT_HOSTNAME: string; + DEFAULT_LISTEN_ADDR: string; + LOG_DISABLE: string; + LOG_ERROR: string; + LOG_WARN: string; + LOG_INFO: string; + LOG_DEBUG: string; + LOG_LOG: string; + LOG_PRIORITIES: string[]; + COLOR_PATTERN: string; + NO_COLOR_PATTERN: string; + CONSOLE_APPENDER: { + type: string; + layout: { type: string; - layout: { - type: string; - pattern: string; - }; + pattern: string; }; - EXIT_CODE: string; - } + }; + EXIT_CODE: string; +} - namespace launcher { - class Launcher { - static generateId(): string; +export namespace launcher { + class Launcher { + static generateId(): string; - constructor(emitter: NodeJS.EventEmitter, injector: any); + constructor(emitter: NodeJS.EventEmitter, injector: any); - // TODO: Can this return value ever be typified? - launch(names: string[], protocol: string, hostname: string, port: number, urlRoot: string): any[]; - kill(id: string, callback: () => void): boolean; - restart(id: string): boolean; - killAll(callback: () => void): void; - areAllCaptured(): boolean; - markCaptured(id: string): void; - } - } - - /** @deprecated */ - interface DeprecatedServer { - /** @deprecated */ - start(options?: any, callback?: ServerCallback): void; - } - - interface Runner { - run(options?: ConfigOptions | ConfigFile, callback?: ServerCallback): void; - } - - interface Stopper { - /** - * This function will signal a running server to stop. The equivalent of karma stop. - */ - stop(options?: ConfigOptions, callback?: ServerCallback): void; - } - - interface TestResults { - disconnected: boolean; - error: boolean; - exitCode: number; - failed: number; - success: number; - } - - class Server extends NodeJS.EventEmitter { - constructor(options?: ConfigOptions | ConfigFile, callback?: ServerCallback); - /** - * Start the server - */ - start(): void; - /** - * Get properties from the injector - * @param token - */ - get(token: string): any; - /** - * Force a refresh of the file list - */ - refreshFiles(): Promise; - - on(event: string, listener: (...args: any[]) => void): this; - - /** - * Listen to the 'run_complete' event. - */ - on(event: 'run_complete', listener: (browsers: any, results: TestResults) => void): this; - - /** - * Backward-compatibility with karma-intellij bundled with WebStorm. - * Deprecated since version 0.13, to be removed in 0.14 - */ - // static start(): void; - } - - type ServerCallback = (exitCode: number) => void; - - interface Config { - set: (config: ConfigOptions) => void; - LOG_DISABLE: string; - LOG_ERROR: string; - LOG_WARN: string; - LOG_INFO: string; - LOG_DEBUG: string; - } - - interface ConfigFile { - configFile: string; - } - - interface ConfigOptions { - /** - * @description Enable or disable watching files and executing the tests whenever one of these files changes. - * @default true - */ - autoWatch?: boolean; - /** - * @description When Karma is watching the files for changes, it tries to batch multiple changes into a single run - * so that the test runner doesn't try to start and restart running tests more than it should. - * The configuration setting tells Karma how long to wait (in milliseconds) after any changes have occurred - * before starting the test process again. - * @default 250 - */ - autoWatchBatchDelay?: number; - /** - * @default '' - * @description The root path location that will be used to resolve all relative paths defined in files and exclude. - * If the basePath configuration is a relative path then it will be resolved to - * the __dirname of the configuration file. - */ - basePath?: string; - /** - * @default 2000 - * @description How long does Karma wait for a browser to reconnect (in ms). - *

- * With a flaky connection it is pretty common that the browser disconnects, - * but the actual test execution is still running without any problems. Karma does not treat a disconnection - * as immediate failure and will wait browserDisconnectTimeout (ms). - * If the browser reconnects during that time, everything is fine. - *

- */ - browserDisconnectTimeout?: number; - /** - * @default 0 - * @description The number of disconnections tolerated. - *

- * The disconnectTolerance value represents the maximum number of tries a browser will attempt - * in the case of a disconnection. Usually any disconnection is considered a failure, - * but this option allows you to define a tolerance level when there is a flaky network link between - * the Karma server and the browsers. - *

- */ - browserDisconnectTolerance?: number; - /** - * @default 10000 - * @description How long will Karma wait for a message from a browser before disconnecting from it (in ms). - *

- * If, during test execution, Karma does not receive any message from a browser within - * browserNoActivityTimeout (ms), it will disconnect from the browser - *

- */ - browserNoActivityTimeout?: number; - /** - * @default [] - * Possible Values: - * - * @description A list of browsers to launch and capture. When Karma starts up, it will also start up each browser - * which is placed within this setting. Once Karma is shut down, it will shut down these browsers as well. - * You can capture any browser manually by opening the browser and visiting the URL where - * the Karma web server is listening (by default it is http://localhost:9876/). - */ - browsers?: string[]; - /** - * @default 60000 - * @description Timeout for capturing a browser (in ms). - *

- * The captureTimeout value represents the maximum boot-up time allowed for a - * browser to start and connect to Karma. If any browser does not get captured within the timeout, Karma - * will kill it and try to launch it again and, after three attempts to capture it, Karma will give up. - *

- */ - captureTimeout?: number; - client?: ClientOptions; - /** - * @default true - * @description Enable or disable colors in the output (reporters and logs). - */ - colors?: boolean; - /** - * @default 'Infinity' - * @description How many browsers Karma launches in parallel. - * Especially on services like SauceLabs and Browserstack, it makes sense only to launch a limited - * amount of browsers at once, and only start more when those have finished. Using this configuration, - * you can specify how many browsers should be running at once at any given point in time. - */ - concurrency?: number; - customLaunchers?: { [key: string]: CustomLauncher }; - /** - * @default [] - * @description List of files/patterns to exclude from loaded files. - */ - exclude?: string[]; - /** - * @default [] - * @description List of files/patterns to load in the browser. - */ - files?: Array; - /** - * @default [] - * @description List of test frameworks you want to use. Typically, you will set this to ['jasmine'], ['mocha'] or ['qunit']... - * Please note just about all frameworks in Karma require an additional plugin/framework library to be installed (via NPM). - */ - frameworks?: string[]; - /** - * @default 'localhost' - * @description Hostname to be used when capturing browsers. - */ - hostname?: string; - /** - * @default {} - * @description Options object to be used by Node's https class. - * Object description can be found in the - * [NodeJS.org API docs](https://nodejs.org/api/tls.html#tls_tls_createserver_options_secureconnectionlistener) - */ - httpsServerOptions?: https.ServerOptions; - /** - * @default config.LOG_INFO - * Possible values: - *
    - *
  • config.LOG_DISABLE
  • - *
  • config.LOG_ERROR
  • - *
  • config.LOG_WARN
  • - *
  • config.LOG_INFO
  • - *
  • config.LOG_DEBUG
  • - *
- * @description Level of logging. - */ - logLevel?: string; - /** - * @default [{type: 'console'}] - * @description A list of log appenders to be used. See the documentation for [log4js] for more information. - */ - loggers?: { [name: string]: Appender } | Appender[]; - /** - * @default [] - * @description List of names of additional middleware you want the - * Karma server to use. Middleware will be used in the order listed. - * You must have installed the middleware via a plugin/framework - * (either inline or via NPM). Additional information can be found in - * [plugins](http://karma-runner.github.io/2.0/config/plugins.html). - * The plugin must provide an express/connect middleware function - * (details about this can be found in the - * [Express](http://expressjs.com/guide/using-middleware.html) docs). - */ - middleware?: string[]; - /** - * @default {} - * @description Redefine default mapping from file extensions to MIME-type. - * Set property name to required MIME, provide Array of extensions (without dots) as it's value. - */ - mime?: {[type: string]: string[]}; - /** - * @default ['karma-*'] - * @description List of plugins to load. A plugin can be a string (in which case it will be required - * by Karma) or an inlined plugin - Object. - * By default, Karma loads all sibling NPM modules which have a name starting with karma-*. - * Note: Just about all plugins in Karma require an additional library to be installed (via NPM). - */ - plugins?: any[]; - /** - * @default 9876 - * @description The port where the web server will be listening. - */ - port?: number; - /** - * @default {'**\/*.coffee': 'coffee'} - * @description A map of preprocessors to use. - * - * Preprocessors can be loaded through [plugins]. - * - * Note: Just about all preprocessors in Karma (other than CoffeeScript and some other defaults) - * require an additional library to be installed (via NPM). - * - * Be aware that preprocessors may be transforming the files and file types that are available at run time. For instance, - * if you are using the "coverage" preprocessor on your source files, if you then attempt to interactively debug - * your tests, you'll discover that your expected source code is completely changed from what you expected. Because - * of that, you'll want to engineer this so that your automated builds use the coverage entry in the "reporters" list, - * but your interactive debugging does not. - * - */ - preprocessors?: { [name: string]: string | string[] }; - /** - * @default 'http:' - * Possible Values: - *
    - *
  • http:
  • - *
  • https:
  • - *
- * @description Protocol used for running the Karma webserver. - * Determines the use of the Node http or https class. - * Note: Using 'https:' requires you to specify httpsServerOptions. - */ - protocol?: string; - /** - * @default {} - * @description A map of path-proxy pairs. - */ - proxies?: { [path: string]: string }; - /** - * @default true - * @description Whether or not Karma or any browsers should raise an error when an inavlid SSL certificate is found. - */ - proxyValidateSSL?: boolean; - /** - * @default 0 - * @description Karma will report all the tests that are slower than given time limit (in ms). - * This is disabled by default (since the default value is 0). - */ - reportSlowerThan?: number; - /** - * @default ['progress'] - * Possible Values: - *
    - *
  • dots
  • - *
  • progress
  • - *
- * @description A list of reporters to use. - * Additional reporters, such as growl, junit, teamcity or coverage can be loaded through plugins. - * Note: Just about all additional reporters in Karma (other than progress) require an additional library to be installed (via NPM). - */ - reporters?: string[]; - /** - * @default false - * @description Continuous Integration mode. - * If true, Karma will start and capture all configured browsers, run tests and then exit with an exit code of 0 or 1 depending - * on whether all tests passed or any tests failed. - */ - singleRun?: boolean; - /** - * @default ['polling', 'websocket'] - * @description An array of allowed transport methods between the browser and testing server. This configuration setting - * is handed off to [socket.io](http://socket.io/) (which manages the communication - * between browsers and the testing server). - */ - transports?: string[]; - /** - * @default '/' - * @description The base url, where Karma runs. - * All of Karma's urls get prefixed with the urlRoot. This is helpful when using proxies, as - * sometimes you might want to proxy a url that is already taken by Karma. - */ - urlRoot?: string; - } - - interface ClientOptions { - /** - * @default undefined - * @description When karma run is passed additional arguments on the command-line, they - * are passed through to the test adapter as karma.config.args (an array of strings). - * The client.args option allows you to set this value for actions other than run. - * How this value is used is up to your test adapter - you should check your adapter's - * documentation to see how (and if) it uses this value. - */ - args?: string[]; - /** - * @default true - * @description Run the tests inside an iFrame or a new window - * 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 - * iFrame and may need a new window to run. - */ - useIframe?: boolean; - /** - * @default true - * @description Capture all console output and pipe it to the terminal. - */ - captureConsole?: boolean; - /** - * @default false - * @description Run the tests on the same window as the client, without using iframe or a new window - */ - runInParent?: boolean; - /** - * @default true - * @description Clear the context window - * If true, Karma clears the context window upon the completion of running the tests. - * If false, Karma does not clear the context window upon the completion of running the tests. - * Setting this to false is useful when embedding a Jasmine Spec Runner Template. - */ - clearContext?: boolean; - } - - interface FilePattern { - /** - * The pattern to use for matching. This property is mandatory. - */ - pattern: string; - /** - * @default true - * @description If autoWatch is true all files that have set watched to true will be watched - * for changes. - */ - watched?: boolean; - /** - * @default true - * @description Should the files be included in the browser using