diff --git a/types/karma/index.d.ts b/types/karma/index.d.ts index 6b6d993af3..b1bab68540 100644 --- a/types/karma/index.d.ts +++ b/types/karma/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Tanguy Krotoff // James Garbutt // Yaroslav Admin +// Piotr Błażejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.2 @@ -164,6 +165,10 @@ export interface ConfigOptions { * the __dirname of the configuration file. */ basePath?: string; + /** + * Configure how the browser console is logged with the following properties, all of which are optional + */ + browserConsoleLogOptions?: BrowserConsoleLogOptions; /** * @default 2000 * @description How long does Karma wait for a browser to reconnect (in ms). @@ -474,6 +479,21 @@ export interface CustomLauncher { platform?: string; } +export interface BrowserConsoleLogOptions { + /** the desired log-level, where level log always is logged */ + level?: 'log' | 'error' | 'warn' | 'info' | 'debug'; + /** + * The format is a string where `%b`, `%t`, `%T`, and `%m` are replaced with the browser string, + * log type in lower-case, log type in uppercase, and log message, respectively. + * This format will only effect the output file + */ + format?: string; + /** output-path of the output-file */ + path?: string; + /** if the log should be written in the terminal, or not */ + terminal?: boolean; +} + export namespace config { function parseConfig(configFilePath: string, cliOptions: ConfigOptions): Config; } diff --git a/types/karma/karma-tests.ts b/types/karma/karma-tests.ts index 91b1c2769e..bc1ee535f1 100644 --- a/types/karma/karma-tests.ts +++ b/types/karma/karma-tests.ts @@ -100,7 +100,13 @@ module.exports = (config: karma.Config) => { }, singleRun: true, - restartOnFileChange: true + restartOnFileChange: true, + browserConsoleLogOptions: { + level: 'warn', + format: '%b %T: %m', + path: 'some/path/to.log', + terminal: false, + }, }); };