From b4583b53563ea8e9e0a127705defcc8359c7635c Mon Sep 17 00:00:00 2001 From: dignifiedquire <dignifiedquire@gmail.com> Date: Thu, 3 Sep 2015 22:30:07 +0200 Subject: [PATCH] fix: Add back `outputFile` config Closes #58 --- index.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index e84a9aa..72063cf 100644 --- a/index.js +++ b/index.js @@ -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 @@ -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) + outputFile = path.join(outputDir, outputFile) + } else { + outputFile = path.join(outputDir, 'TESTS-' + safeBrowserName + '.xml') + } + var xmlToOutput = suites[browser.id] pendingFileWritings++