Skip to content

Commit

Permalink
fix: Add back outputFile config
Browse files Browse the repository at this point in the history
Closes #58
  • Loading branch information
dignifiedquire committed Sep 3, 2015
1 parent a5e951a commit b4583b5
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var JUnitReporter = function (baseReporterDecorator, config, logger, helper, for
var reporterConfig = config.junitReporter || {}
var pkgName = reporterConfig.suite || ''
var outputDir = reporterConfig.outputDir
var outputFile = reporterConfig.outputFile

var suites
var pendingFileWritings = 0
Expand All @@ -30,16 +31,24 @@ var JUnitReporter = function (baseReporterDecorator, config, logger, helper, for
var timestamp = (new Date()).toISOString().substr(0, 19)
var suite = suites[browser.id] = builder.create('testsuite')
suite.att('name', browser.name)
.att('package', pkgName)
.att('timestamp', timestamp)
.att('id', 0)
.att('hostname', os.hostname())
.att('package', pkgName)
.att('timestamp', timestamp)
.att('id', 0)
.att('hostname', os.hostname())

suite.ele('properties')
.ele('property', {name: 'browser.fullName', value: browser.fullName})
.ele('property', {name: 'browser.fullName', value: browser.fullName})
}

var writeXmlForBrowser = function (browser) {
var outputFile = outputDir + 'TESTS-' + browser.name.replace(/ /g, '_') + '.xml'
var safeBrowserName = browser.name.replace(/ /g, '_')
if (outputFile != null) {
outputDir = path.join(outputDir, safeBrowserName)

This comment has been minimized.

Copy link
@aindlq

aindlq Sep 11, 2015

because outputDir is mutable and reused for all browser resulted path is actually not correct.
e.g for two browser, for second one it will be something like:

PhantomJS_1.9.8_(Linux_0.0.0)/Chrome_45.0.2454_(Linux_0.0.0)

outputFile = path.join(outputDir, outputFile)

This comment has been minimized.

Copy link
@aindlq

aindlq Sep 11, 2015

The same problem actually affects outputFile

} else {
outputFile = path.join(outputDir, 'TESTS-' + safeBrowserName + '.xml')
}

var xmlToOutput = suites[browser.id]

pendingFileWritings++
Expand Down

0 comments on commit b4583b5

Please sign in to comment.