2018-01-10 14:19:34 +01:00
|
|
|
var artifacts = require("../../artifacts");
|
|
|
|
var fs = require("fs");
|
|
|
|
var istanbulCov = require('istanbul-lib-coverage');
|
|
|
|
|
|
|
|
var COVERAGE_PATH = artifacts.pathSync("/coverage");
|
|
|
|
|
|
|
|
|
|
|
|
var coverage = istanbulCov.createCoverageMap({});
|
|
|
|
|
2018-01-17 18:36:46 +01:00
|
|
|
// Capture the coverage after each test
|
|
|
|
afterEach(function() {
|
|
|
|
// Code coverage
|
|
|
|
var results = browser.execute(function() {
|
|
|
|
return window.__coverage__;
|
|
|
|
});
|
2018-01-10 14:19:34 +01:00
|
|
|
|
2018-01-17 18:36:46 +01:00
|
|
|
coverage.merge(results.value);
|
|
|
|
})
|
2018-01-10 14:19:34 +01:00
|
|
|
|
2018-01-17 18:36:46 +01:00
|
|
|
// Dump the coverage to a file
|
|
|
|
after(function() {
|
|
|
|
var jsonStr = JSON.stringify(coverage, null, 2);
|
|
|
|
fs.writeFileSync(COVERAGE_PATH+"/coverage.json", jsonStr);
|
2018-01-10 14:19:34 +01:00
|
|
|
})
|