Skip to content

Commit

Permalink
tests: Actually invoke mocha instead of mocking it out
Browse files Browse the repository at this point in the history
See michaelleeallen#83 for rationale.

In the future, it would be useful if we could test against multiple
versions of mocha instead of just the one listed in `devDependencies`.

Closes michaelleeallen#83
  • Loading branch information
gabegorelick committed May 25, 2020
1 parent fd6ed97 commit e0d8ffc
Show file tree
Hide file tree
Showing 9 changed files with 551 additions and 530 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.js
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
"env": {
"browser": true,
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,7 +1,8 @@
.c9/
.idea/
node_modules/
test/subdir/
test/*.xml
test/output/
node-debug*
npm-debug*
test-results.xml
7 changes: 4 additions & 3 deletions index.js
Expand Up @@ -203,6 +203,7 @@ function MochaJUnitReporter(runner, options) {
this._antId = 0;

var testsuites = [];
this._testsuites = testsuites;

function lastSuite() {
return testsuites[testsuites.length - 1].testsuite;
Expand Down Expand Up @@ -366,12 +367,12 @@ MochaJUnitReporter.prototype.removeInvalidCharacters = function(input){
* @param {Array.<Object>} testsuites - a list of xml configs
*/
MochaJUnitReporter.prototype.flush = function(testsuites){
var xml = this.getXml(testsuites);
this._xml = this.getXml(testsuites);

this.writeXmlToDisk(xml, this._options.mochaFile);
this.writeXmlToDisk(this._xml, this._options.mochaFile);

if (this._options.toConsole === true) {
console.log(xml); // eslint-disable-line no-console
console.log(this._xml); // eslint-disable-line no-console
}
};

Expand Down
20 changes: 16 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -28,6 +28,7 @@
"chai-xml": "^0.3.0",
"eslint": "^7.0.0",
"mocha": "^7.2.0",
"rimraf": "^3.0.2",
"test-console": "^1.0.0",
"xmllint": "^0.1.1"
},
Expand Down
52 changes: 0 additions & 52 deletions test/helpers/mock-runner.js

This file was deleted.

12 changes: 0 additions & 12 deletions test/helpers/mock-test.js

This file was deleted.

0 comments on commit e0d8ffc

Please sign in to comment.