mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-07 23:40:21 -05:00
feat: Add after:spec event (#14178)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user