From d57127ed0897ba105a870a2d3383928de3cc8438 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Mon, 18 Nov 2019 15:04:31 +0300 Subject: [PATCH] [Debugger, JS] Fix for mocha timeout --- .../kotlin-test-js-runner/karma-debug.js | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/libraries/tools/kotlin-test-js-runner/karma-debug.js b/libraries/tools/kotlin-test-js-runner/karma-debug.js index 74b87ee2ca7..ffa29928ce6 100644 --- a/libraries/tools/kotlin-test-js-runner/karma-debug.js +++ b/libraries/tools/kotlin-test-js-runner/karma-debug.js @@ -14,6 +14,7 @@ const karmaConfig = cfg.parseConfig(process.argv[2]); karmaConfig.singleRun = false; configureBrowsers(karmaConfig); +fixMochaTimeout(karmaConfig); const Server = karma.Server; const server = new Server(karmaConfig, function (exitCode) { @@ -87,9 +88,33 @@ function isDebuggableBrowser(browserName, config) { const port = parseInt(value.substring(prefix.length), 10); if (isNaN(port) || port !== 9222) { - console.warn(`Debugger expect 9222 port, but ${port} found`); + console.error(`Debugger expect 9222 port, but ${port} found`); return false; } return true; +} + +function fixMochaTimeout(config) { + let client = config.client; + if (typeof client === 'undefined') { + config.client = client = {}; + } + if (client === Object(client)) { + let mocha = client.mocha; + if (typeof mocha === 'undefined') { + client.mocha = mocha = {}; + } + if (mocha === Object(mocha)) { + mocha.timeout = 0; + } + else { + console.error('config.client.mocha is not an object'); + process.exit(1); + } + } + else { + console.error('config.client is not an object'); + process.exit(1); + } } \ No newline at end of file