feat: Add after:spec event (#14178)

This commit is contained in:
Chris Breiding
2020-12-18 09:45:15 -05:00
committed by GitHub
parent 7d4e38e4c5
commit c9916c8bbd
11 changed files with 103 additions and 65 deletions
@@ -111,6 +111,9 @@ const execute = (ipc, event, ids, args = []) => {
'after:screenshot' () {
util.wrapChildPromise(ipc, invoke, ids, args)
},
'after:spec' () {
util.wrapChildPromise(ipc, invoke, ids, args)
},
'before:browser:launch' () {
browserLaunch.wrap(ipc, invoke, ids, args)
},
@@ -34,8 +34,13 @@ const eventValidators = {
'_get:task:body': isFunction,
}
const runEvents = {
'after:spec': true,
'before:spec': true,
}
const validateEvent = (event, handler, config) => {
if (event === 'before:spec') {
if (runEvents[event]) {
return isValidRunEvent(event, handler, config)
}
+1 -1
View File
@@ -4,7 +4,7 @@ const errors = require('../errors')
const plugins = require('../plugins')
module.exports = {
execute: Promise.method((eventName, config, ...args) => {
execute: Promise.method((eventName, config = {}, ...args) => {
if (!config.experimentalRunEvents) return
if (!plugins.has(eventName)) return