File tree 4 files changed +26
-5
lines changed
4 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 1
1
language : node_js
2
2
node_js :
3
- - ' 6'
4
- - ' 8'
5
- - ' 10'
3
+ - " 6"
4
+ - " 8"
5
+ - " 10"
6
+ script : npm test
6
7
deploy :
7
8
provider : npm
8
9
email : $NPM_EMAIL
Original file line number Diff line number Diff line change @@ -200,4 +200,4 @@ output line 2
200
200
[ travis-build ] : https://travis-ci.org/michaelleeallen/mocha-junit-reporter
201
201
[ npm-badge ] : https://img.shields.io/npm/v/mocha-junit-reporter.svg?maxAge=2592000
202
202
[ npm-listing ] : https://www.npmjs.com/package/mocha-junit-reporter
203
- [ ant-schema ] : http://windyroad.org/dl/Open%20Source/JUnit.xsd
203
+ [ ant-schema ] : http://windyroad.org/dl/Open%20Source/JUnit.xsd
Original file line number Diff line number Diff line change @@ -9,6 +9,23 @@ var mkdirp = require('mkdirp');
9
9
var md5 = require ( 'md5' ) ;
10
10
var stripAnsi = require ( 'strip-ansi' ) ;
11
11
12
+ var createStatsCollector ;
13
+ var mocha6plus ;
14
+
15
+ try {
16
+ var json = JSON . parse (
17
+ fs . readFileSync ( "./node_modules/mocha/package.json" , "utf8" )
18
+ ) ;
19
+ version = json . version ;
20
+ if ( version >= "6" ) {
21
+ createStatsCollector = require ( "mocha/lib/stats-collector" ) ;
22
+ mocha6plus = true ;
23
+ } else {
24
+ mocha6plus = false ;
25
+ }
26
+ } catch ( e ) {
27
+ console . warn ( "Couldn't determine Mocha version" ) ;
28
+ }
12
29
module . exports = MochaJUnitReporter ;
13
30
14
31
// A subset of invalid characters as defined in http://www.w3.org/TR/xml/#charsets that can occur in e.g. stacktraces
@@ -155,6 +172,9 @@ function getJenkinsClassname (test) {
155
172
* @param {Object } options - mocha options
156
173
*/
157
174
function MochaJUnitReporter ( runner , options ) {
175
+ if ( mocha6plus ) {
176
+ createStatsCollector ( runner ) ;
177
+ }
158
178
this . _options = configureDefaults ( options ) ;
159
179
this . _runner = runner ;
160
180
this . _generateSuiteTitle = this . _options . useFullSuiteTitle ? fullSuiteTitle : defaultSuiteTitle ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " mocha-junit-reporter" ,
3
- "version" : " 1.22 .0" ,
3
+ "version" : " 1.23 .0" ,
4
4
"description" : " A JUnit reporter for mocha." ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments