-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adopt js reporters standard #1026
Changes from all commits
0ed05b1
a167331
fb7d73c
3a502ef
2fd7197
5dfb37f
48bab35
31f4313
628666a
b5679b6
404918d
5237b39
4f15575
8cecfb6
444ce47
85c5b98
82f39b2
fc4a9e1
251aa50
f522ae6
6ea1edb
79e4397
1dfaa16
315c9b3
978064f
32c24ca
0a69b20
9fd2e0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,12 @@ import exportQUnit from "./export"; | |
|
||
import config from "./core/config"; | ||
import { defined, extend, objectType, is, now } from "./core/utilities"; | ||
import { registerLoggingCallbacks, runLoggingCallbacks } from "./core/logging"; | ||
import { on, emit, registerLoggingCallbacks, | ||
runLoggingCallbacks } from "./core/logging"; | ||
import { sourceFromStacktrace } from "./core/stacktrace"; | ||
|
||
import {Suite} from "js-reporters/lib/Data"; | ||
|
||
const QUnit = {}; | ||
|
||
var globalStartCalled = false; | ||
|
@@ -41,6 +44,7 @@ extend( QUnit, { | |
} | ||
|
||
module = createModule(); | ||
createSuite( module ); | ||
|
||
if ( testEnvironment && ( testEnvironment.setup || testEnvironment.teardown ) ) { | ||
console.warn( | ||
|
@@ -94,6 +98,30 @@ extend( QUnit, { | |
return module; | ||
} | ||
|
||
function createSuite( module ) { | ||
var parentSuite; | ||
var fullName; | ||
var suite; | ||
|
||
if ( module.parentModule !== null ) { | ||
parentSuite = config.moduleToSuite[ module.parentModule.moduleId ]; | ||
} else { | ||
parentSuite = config.globalSuite; | ||
} | ||
|
||
fullName = parentSuite.fullName.slice(); | ||
fullName.push( module.name ); | ||
|
||
suite = new Suite( module.name, fullName, [], [] ); | ||
|
||
parentSuite.childSuites.push( suite ); | ||
suite.parent = parentSuite; | ||
suite.finishedTests = 0; | ||
config.moduleToSuite[ module.moduleId ] = suite; | ||
|
||
return suite; | ||
} | ||
|
||
function setCurrentModule( module ) { | ||
config.currentModule = module; | ||
} | ||
|
@@ -106,6 +134,8 @@ extend( QUnit, { | |
|
||
only: only, | ||
|
||
on: on, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we can now use ES6 (right?), this can be shortened to just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but I would leave it like this, to be equal to the others props, this can be changed in another pr. |
||
|
||
start: function( count ) { | ||
var globalStartAlreadyCalled = globalStartCalled; | ||
|
||
|
@@ -224,6 +254,8 @@ export function begin() { | |
totalTests: Test.count, | ||
modules: modulesLog | ||
} ); | ||
|
||
emit( "runStart", config.globalSuite ); | ||
} | ||
|
||
config.blocking = false; | ||
|
@@ -272,6 +304,13 @@ function done() { | |
total: config.moduleStats.all, | ||
runtime: now() - config.moduleStats.started | ||
} ); | ||
|
||
// Do not emit the "suiteEnd" event for the globalSuite. | ||
if ( config.previousModule.moduleId ) { | ||
var suite = config.moduleToSuite[ config.previousModule.moduleId ]; | ||
|
||
emit( "suiteEnd", suite ); | ||
} | ||
} | ||
delete config.previousModule; | ||
|
||
|
@@ -284,6 +323,8 @@ function done() { | |
total: config.stats.all, | ||
runtime: runtime | ||
} ); | ||
|
||
emit( "runEnd", config.globalSuite ); | ||
} | ||
|
||
function setHook( module, hookName ) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍