mirror of
https://github.com/atom/atom.git
synced 2026-01-26 15:28:27 -05:00
Subclass the Jasmine JUnit reporter to touch up the spec descriptions
This commit is contained in:
20
spec/jasmine-junit-reporter.js
Normal file
20
spec/jasmine-junit-reporter.js
Normal file
@@ -0,0 +1,20 @@
|
||||
require('jasmine-reporters')
|
||||
|
||||
class JasmineJUnitReporter extends jasmine.JUnitReporter {
|
||||
fullDescription (spec) {
|
||||
let fullDescription = spec.description
|
||||
let currentSuite = spec.suite
|
||||
while (currentSuite) {
|
||||
fullDescription = currentSuite.description + ' ' + fullDescription
|
||||
currentSuite = currentSuite.parentSuite
|
||||
}
|
||||
return fullDescription
|
||||
}
|
||||
|
||||
reportSpecResults (spec) {
|
||||
spec.description = this.fullDescription(spec)
|
||||
return super.reportSpecResults(spec)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { JasmineJUnitReporter }
|
||||
@@ -42,12 +42,12 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) ->
|
||||
jasmineEnv.addReporter(new TimeReporter())
|
||||
|
||||
if process.env.TEST_JUNIT_XML_PATH
|
||||
require 'jasmine-reporters'
|
||||
{JasmineJUnitReporter} = require './jasmine-junit-reporter'
|
||||
process.stdout.write "Outputting JUnit XML to <#{process.env.TEST_JUNIT_XML_PATH}>\n"
|
||||
outputDir = path.dirname(process.env.TEST_JUNIT_XML_PATH)
|
||||
fileBase = path.basename(process.env.TEST_JUNIT_XML_PATH, '.xml')
|
||||
|
||||
jasmineEnv.addReporter new jasmine.JUnitXmlReporter(outputDir, true, false, fileBase, true)
|
||||
jasmineEnv.addReporter new JasmineJUnitReporter(outputDir, true, false, fileBase, true)
|
||||
else
|
||||
process.stdout.write "No JUnit XML\n"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user