Merge pull request #18788 from atom/aw/jasmine-reporter

Use a custom Jasmine reporter to actually show spec names
This commit is contained in:
Ash Wilson 2019-02-05 12:36:19 -05:00 committed by GitHub
commit 0c29022aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 3 deletions

View File

@ -15,7 +15,7 @@ matrix:
include:
- os: linux
dist: trusty
env: NODE_VERSION=8.9.3 DISPLAY=:99.0 CC=clang CXX=clang++ npm_config_clang=1
env: NODE_VERSION=8.9.3 DISPLAY=:99.0 CC=clang CXX=clang++ npm_config_clang=1 ATOM_JASMINE_REPORTER=list
sudo: required

View File

@ -19,6 +19,7 @@ platform:
environment:
global:
ATOM_DEV_RESOURCE_PATH: c:\projects\atom
ATOM_JASMINE_REPORTER: list
TEST_JUNIT_XML_ROOT: c:\projects\junit-test-results
NODE_VERSION: 8.9.3

View File

@ -24,6 +24,7 @@ jobs:
env:
CI: true
CI_PROVIDER: VSTS
ATOM_JASMINE_REPORTER: list
displayName: Run tests
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))

View File

@ -44,6 +44,7 @@ jobs:
env:
CI: true
CI_PROVIDER: VSTS
ATOM_JASMINE_REPORTER: list
displayName: Run tests
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))

View File

@ -69,6 +69,7 @@ jobs:
env:
CI: true
CI_PROVIDER: VSTS
ATOM_JASMINE_REPORTER: list
BUILD_ARCH: $(buildArch)
displayName: Run tests
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))

View File

@ -0,0 +1,35 @@
const {TerminalReporter} = require('jasmine-tagged')
class JasmineListReporter extends TerminalReporter {
fullDescription (spec) {
let fullDescription = spec.description
let currentSuite = spec.suite
while (currentSuite) {
fullDescription = currentSuite.description + ' > ' + fullDescription
currentSuite = currentSuite.parentSuite
}
return fullDescription
}
reportSpecStarting (spec) {
this.print_(this.fullDescription(spec) + ' ')
}
reportSpecResults (spec) {
const result = spec.results()
if (result.skipped) {
return
}
let msg = ''
if (result.passed()) {
msg = this.stringWithColor_('[pass]', this.color_.pass())
} else {
msg = this.stringWithColor_('[FAIL]', this.color_.fail())
this.addFailureToFailures_(spec)
}
this.printLine_(msg)
}
}
module.exports = { JasmineListReporter }

View File

@ -94,8 +94,7 @@ buildTerminalReporter = (logFile, resolveWithExitCode) ->
else
ipcRenderer.send 'write-to-stderr', str
{TerminalReporter} = require 'jasmine-tagged'
new TerminalReporter
options =
print: (str) ->
log(str)
onComplete: (runner) ->
@ -109,3 +108,10 @@ buildTerminalReporter = (logFile, resolveWithExitCode) ->
resolveWithExitCode(1)
else
resolveWithExitCode(0)
if process.env.ATOM_JASMINE_REPORTER is 'list'
{JasmineListReporter} = require './jasmine-list-reporter'
new JasmineListReporter(options)
else
{TerminalReporter} = require 'jasmine-tagged'
new TerminalReporter(options)