From 0cec0cf595670de0e1b2779c5ef7244f83d8b375 Mon Sep 17 00:00:00 2001 From: orangemug Date: Wed, 17 Jan 2018 17:36:46 +0000 Subject: [PATCH] Fix coverage in tests. --- .circleci/config.yml | 2 +- test/functional/util/coverage.js | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c194ce8..d6e8922 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,6 @@ jobs: - run: mkdir -p /tmp/artifacts/logs - run: DOCKER_HOST=localhost npm test - run: npm run build - - run: npm test + - run: ./node_modules/.bin/istanbul report --include /tmp/artifacts/coverage/coverage.json --dir /tmp/artifacts/coverage html lcov - store_artifacts: path: /tmp/artifacts diff --git a/test/functional/util/coverage.js b/test/functional/util/coverage.js index 335decd..173e44a 100644 --- a/test/functional/util/coverage.js +++ b/test/functional/util/coverage.js @@ -7,20 +7,18 @@ var COVERAGE_PATH = artifacts.pathSync("/coverage"); var coverage = istanbulCov.createCoverageMap({}); -describe("coverage", function() { - // Capture the coverage after each test - afterEach(function() { - // Code coverage - var results = browser.execute(function() { - return window.__coverage__; - }); +// Capture the coverage after each test +afterEach(function() { + // Code coverage + var results = browser.execute(function() { + return window.__coverage__; + }); - coverage.merge(results.value); - }) - - // Dump the coverage to a file - after(function() { - var jsonStr = JSON.stringify(coverage, null, 2); - fs.writeFileSync(COVERAGE_PATH+"/coverage.json", jsonStr); - }) + coverage.merge(results.value); +}) + +// Dump the coverage to a file +after(function() { + var jsonStr = JSON.stringify(coverage, null, 2); + fs.writeFileSync(COVERAGE_PATH+"/coverage.json", jsonStr); })