Union type in after:run
plugin no longer works
#27827
Unanswered
katsadim
asked this question in
Questions and Help
Replies: 3 comments
-
Did you ever figure this out? this is causing me problems trying to upgrade to cypress v13 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Unfortunately i gave up on it. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I ended up being able to do this to return if it failed or not const resultIsFailure = (
result: CypressCommandLine.CypressRunResult | CypressCommandLine.CypressFailedRunResult,
) => {
if ('status' in result) {
return result.status === 'failed'
}
return result.totalFailed > 0
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
this is mainly a typescript question and it goes like this:
We have the following code in cypress/cli/types/cypress.d.ts:
Lets focus on the type of the
results
argument. This is a union type. And there is no nice way to discriminate the union!This PR "breaking: Normalize results from module api, after:run, and after:spec" and more specifically the removal of the common field
status
fromCypressRunResult
field in this change seems to be the culprit.According to the (admitedely deprecated) TS documentation, we need a common field to discriminate union types. But now this common type is gone!
Before I would do sth like:
But I am not sure what to do now! Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions