Skip to content

Commit fababe6

Browse files
gabegorelickclayreimann
authored andcommitted
tests: Actually invoke mocha instead of mocking it out
See #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 #83
1 parent 076aeab commit fababe6

8 files changed

+549
-530
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.c9/
22
.idea/
33
node_modules/
4-
test/subdir/
54
test/*.xml
5+
test/output/
66
node-debug*
77
npm-debug*
8+
test-results.xml

index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ function MochaJUnitReporter(runner, options) {
203203
this._antId = 0;
204204

205205
var testsuites = [];
206+
this._testsuites = testsuites;
206207

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

371-
this.writeXmlToDisk(xml, this._options.mochaFile);
372+
this.writeXmlToDisk(this._xml, this._options.mochaFile);
372373

373374
if (this._options.toConsole === true) {
374-
console.log(xml); // eslint-disable-line no-console
375+
console.log(this._xml); // eslint-disable-line no-console
375376
}
376377
};
377378

package-lock.json

+16-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"chai-xml": "^0.3.0",
2929
"eslint": "^7.0.0",
3030
"mocha": "^7.2.0",
31+
"rimraf": "^3.0.2",
3132
"test-console": "^1.0.0",
3233
"xmllint": "^0.1.1"
3334
},

test/helpers/mock-runner.js

-52
This file was deleted.

test/helpers/mock-test.js

-12
This file was deleted.

0 commit comments

Comments
 (0)