Skip to content

Commit

Permalink
chore: removes custom mocha reporter with test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-zakharchenko committed Aug 19, 2019
1 parent 4e58d46 commit 495ddf3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 68 deletions.
36 changes: 0 additions & 36 deletions bin/dredd
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/usr/bin/env node

/* eslint-disable global-require */

const fs = require('fs');
const path = require('path');

// Ignore this block, it's pure magic, temporary fix
// for https://github.com/nodejs/node/issues/6456
[process.stdout, process.stderr].forEach((s) => {
Expand All @@ -22,35 +17,4 @@ const dreddCli = new CLI({
},
});

if (process.env.COVERAGE_DIR) {
process.on('exit', () => {
// Before Dredd exits, we need to collect coverage stats and save them to
// a file. We abuse 'mocha-lcov-reporter' to do this.
const LCov = require('mocha-lcov-reporter');

// Pretending there is Mocha runner
const EventEmitter = require('events').EventEmitter;
const runner = new EventEmitter();

// Monkey-patching 'LCov.prototype.write' to catch all output to a variable
let content = '';
const write = LCov.prototype.write;

LCov.prototype.write = (string) => {
content += string;
};

// Collecting the stats
new LCov(runner);
runner.emit('end');

// Undo the monkey-patching
LCov.prototype.write = write;

// Save stats as lcov file
const file = path.join(process.env.COVERAGE_DIR, 'dredd-bin.info');
fs.appendFileSync(file, content);
});
}

dreddCli.run();
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@
"eslint-config-airbnb-base": "13.2.0",
"eslint-plugin-import": "2.18.2",
"express": "4.17.1",
"lcov-result-merger": "3.1.0",
"mocha": "6.2.0",
"mocha-lcov-reporter": "1.3.0",
"nock": "10.0.6",
"ps-node": "0.1.6",
"semantic-release": "15.13.17",
Expand Down
1 change: 0 additions & 1 deletion test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--reporter=test/reporter.js
--timeout=120000
--recursive
29 changes: 0 additions & 29 deletions test/reporter.js

This file was deleted.

0 comments on commit 495ddf3

Please sign in to comment.