From 8ca0141e56fc83a0817ee907fd3c3c0a28a7b346 Mon Sep 17 00:00:00 2001 From: 43081j <43081j@localhost> Date: Sat, 16 Dec 2017 18:19:36 +0000 Subject: [PATCH] add karma client options Fixes #22216 --- types/karma/index.d.ts | 14 ++++++++++++++ types/karma/karma-tests.ts | 14 +++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/types/karma/index.d.ts b/types/karma/index.d.ts index 3a77107718..e2cce2c340 100644 --- a/types/karma/index.d.ts +++ b/types/karma/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for karma 1.7 // Project: https://github.com/karma-runner/karma // Definitions by: Tanguy Krotoff +// James Garbutt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -414,6 +415,19 @@ declare namespace karma { * @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 { diff --git a/types/karma/karma-tests.ts b/types/karma/karma-tests.ts index 2eeed9b480..b21fa88e50 100644 --- a/types/karma/karma-tests.ts +++ b/types/karma/karma-tests.ts @@ -51,7 +51,7 @@ server.on('run_complete', (browsers, results) => { results.error = false; results.exitCode = 0; results.failed = 9; - results.success = 10; + results.success = 10; }); //var runner = require('karma').runner; => cannot use this syntax otherwise runner is of type any @@ -108,3 +108,15 @@ module.exports = function(config: karma.Config) { singleRun: true }); }; + +const foo = (config: karma.Config) => { + config.set({ + client: { + args: ['a', 'b'], + useIframe: true, + runInParent: true, + captureConsole: true, + clearContext: true + } + }); +};