-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Module API doesn't fail the promise with Cypress failure messages #3216
Comments
I confirm the problem for these cases:
For both of these cases, the promise resolves and I think it should be rejected. Workaround:cypress.run(...).then((testResults) => {
if (testResults.status === "failed") {
// For some reason, Cypress resolves its promise even when
// it can't start the tests. I think rejection is better
// suited. https://github.com/cypress-io/cypress/issues/3216
return Promise.reject(testResults);
}
// When Cypress manages to run the tests (all of them
// successful or not), we want to resolve the promise
// successfully:
return testResults;
}) |
@jennifer-shehane Let me know if this should be a separate issue, but I have a related request: When using the Cypress module API (I am using v9.7.0), it's possible to parse CLI arguments using For my use case, I'd much rather be able to try/catch and trap the error. It won't work to add a Maybe it would be possible to detect if the module was Thanks! |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Forgive me if this issue exists, I wasn't able to find it.
Current behavior:
If using the Module API and Cypress fails for various reasons (
baseUrl
isn't reachable,spec
isn't found) the module API resolves with a shape of{ failures: 1, message: "Cypress error message" }
instead of rejecting.Desired behavior:
The module API should reject the promise with an error message. This is then easier to detect failure cases. There is a difference between failing to run because of some error and running successfully and returning results that could contain failed tests.
Steps to reproduce: (app code and test code)
You can run this from from any project that has Cypress in it:
Running that will output a red error message from Cypress, but the process will exit with a 0. Even without an explicit
process.exit
and having no.catch
will do the same thing. The issue can be mitigated by adding the following after the.then(result =>
line:Versions
Cypress 3.1.4
The text was updated successfully, but these errors were encountered: