-
Notifications
You must be signed in to change notification settings - Fork 520
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
fix(cli): allow beforeafter validation schema to run engines without flow #2396
fix(cli): allow beforeafter validation schema to run engines without flow #2396
Conversation
@@ -105,9 +105,13 @@ const scenarioItem = Joi.object({ | |||
}); | |||
|
|||
const beforeAfterSchema = Joi.object({ |
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.
Previously the schema would look at config.engines
to determine this. However, this is more complicated than just looking at the engine
field within before/after itself:
- If it doesn't have it, it's http (default), so it needs flow.
- If it has it, and if it's
socketio
,ws
orhttp
, it needs flow. Otherwise it does not require flow (e.g. custom engine orplaywright
).
Looking at config.engines
doesn't actually make sense, since you could be putting a config there for an engine you're using in your scenario, but not in before/after
.
|
||
if (typeof engine === 'undefined') { | ||
throw new Error( | ||
`Failed to run ${hook} hook: unknown engine "${name}". Did you forget to include it in "config.engines.${name}"?` | ||
); | ||
} |
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.
similar logic to #2101 for consistency
…lidate-script-schema-to-run-arbitrary
Description
In theory any
engine
can run as abefore/after
hook. However, if the engine doesn't includeflow
, it will currently fail. This PR fixes that, and also introduces an error message whenbefore.engine
is configured without the correspondingconfig.engine
(similar to #2101).Having this will enable e.g.
playwright
scenarios to be run as abefore
.Note: I will fix the VS code schema separately in another PR.
Pre-merge checklist