diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-13 21:51:11 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-13 21:51:11 +0100 |
commit | 17d4956bd32f5fc27c91a89515c8d5878f7e6298 (patch) | |
tree | 5777a3ece655ecaae56060d92570e796b1d3e9f7 /testlib/selenium | |
parent | 1666c2b5705e85a14aa8bcf95e98c3eb1812310b (diff) |
test harness
Diffstat (limited to 'testlib/selenium')
-rw-r--r-- | testlib/selenium/runtime.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/testlib/selenium/runtime.js b/testlib/selenium/runtime.js index 5a23c19a0..06dd56330 100644 --- a/testlib/selenium/runtime.js +++ b/testlib/selenium/runtime.js @@ -26,6 +26,7 @@ var chrome = require('selenium-webdriver/chrome'); var path = require("path"); var process = require("process"); var fs = require("fs"); +var globSync = require("glob").sync; var connect = require('connect'); var serveStatic = require('serve-static'); @@ -137,6 +138,24 @@ if (argv["coverage"]) { driver.executeScript(script); driver.wait(untilTestOver); +function augmentCoverage(cov) { + for (let file of globSync(projectRoot + "/lib/**/*.js")) { + if (file in cov) { + continue; + } + cov[file] = { + "path":file, + "s":{"1":0}, + "b":{}, + "f":{}, + "fnMap":{}, + "statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":1,"column":0}}}, + "branchMap":{} + } + } +} + + driver.manage().logs().get("browser").then((logs) => { for (let l of logs) { if (l.message.startsWith("{")) { @@ -161,6 +180,7 @@ driver.manage().logs().get("browser").then((logs) => { let c = covTranslated[p] = cov[f]; c.path = p; } + augmentCoverage(covTranslated); fs.writeFileSync(`coverage-${testName}-${randId(5)}.json`, JSON.stringify(covTranslated)); } if (!argv["keep-open"]) { |