Commit bad505c4 authored by Tasso Evangelista's avatar Tasso Evangelista

Replace istanbul with nyc

parent 76d86137
......@@ -13,7 +13,8 @@
"url": "https://github.com/RocketChat/Rocket.Chat.Electron.git"
},
"scripts": {
"postinstall": "electron-builder install-app-deps",
"postinstall": "electron-builder install-app-deps",
"postremove": "electron-builder install-app-deps",
"start": "gulp start",
"build": "gulp build-app",
"changelog": "conventional-changelog --config .github/changelog.js -i HISTORY.md -s",
......@@ -26,9 +27,10 @@
"test-renderer": "xvfb-maybe electron-mocha --require source-map-support/register --renderer app/renderer.specs.js",
"test": "npm-run-all test-main test-renderer",
"precoverage": "gulp build-coverage-tests --env=test",
"coverage-main": "xvfb-maybe electron-mocha --require source-map-support/register --reporter scripts/istanbul-reporter app/main.specs.js",
"coverage-renderer": "xvfb-maybe electron-mocha --require source-map-support/register --reporter scripts/istanbul-reporter app/renderer.specs.js",
"coverage-main": "xvfb-maybe electron-mocha --require source-map-support/register --reporter tasks/coverage-reporter app/main.specs.js",
"coverage-renderer": "xvfb-maybe electron-mocha --require source-map-support/register --reporter tasks/coverage-reporter app/renderer.specs.js",
"coverage": "npm-run-all coverage-main coverage-renderer",
"postcoverage": "node tasks/coverage-reporter",
"pree2e": "gulp build-e2e-tests --env=test",
"e2e": "xvfb-maybe mocha --require source-map-support/register app/e2e.js"
},
......@@ -57,10 +59,10 @@
"gulp-rename": "^1.4.0",
"gulp-util": "^3.0.8",
"gulp-watch": "^5.0.1",
"istanbul": "^0.4.5",
"minimist": "^1.2.0",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.3",
"nyc": "^13.1.0",
"rollup": "^0.67.3",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-istanbul": "^2.0.1",
......
var istanbul = require('istanbul');
const mocha = require('mocha');
module.exports = function (runner, options) {
mocha.reporters.Base.call(this, runner);
var reporterOpts = { dir: 'coverage' },
reporters = ['text-summary', 'html'];
options = options || {};
if (options.reporters) reporters = options.reporters.split(',');
if (process.env.ISTANBUL_REPORTERS) reporters = process.env.ISTANBUL_REPORTERS.split(',');
if (options.reportDir) reporterOpts.dir = options.reportDir;
if (process.env.ISTANBUL_REPORT_DIR) reporterOpts.dir = process.env.ISTANBUL_REPORT_DIR;
runner.on('end', function(){
var cov = global.__coverage__ || {},
collector = new istanbul.Collector();
collector.add(cov);
reporters.forEach(function(reporter) {
istanbul.Report.create(reporter, reporterOpts).writeReport(collector, true);
});
});
};
const { reporters: { Base } } = require('mocha');
const NYC = require('nyc');
module.exports = function(runner, options = {}) {
Base.call(this, runner, options);
runner.on('end', () => {
const nyc = new NYC({ include: 'src/' });
nyc.createTempDirectory();
nyc.addAllFiles();
});
};
if (require.main === module) {
const nyc = new NYC({
include: 'src/',
reporter: ['text-summary', 'html'],
reportDir: 'coverage',
});
nyc.report();
nyc.cleanup();
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment