fix(karma): missing browserConsoleLogOptions configuration option (#42393)

- definition amended
- test updated

Thanks!
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz)
2020-02-17 16:59:57 -08:00
committed by GitHub
parent 5fa54b55ee
commit a11e1e2095
2 changed files with 27 additions and 1 deletions
+20
View File
@@ -3,6 +3,7 @@
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// James Garbutt <https://github.com/43081j>
// Yaroslav Admin <https://github.com/devoto13>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.2
@@ -164,6 +165,10 @@ export interface ConfigOptions {
* the <code>__dirname</code> 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;
}
+7 -1
View File
@@ -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,
},
});
};