-
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
Misleading cy.task error message when returning Promise<undefined> #6241
Comments
We can update the error message to be more descriptive that the Promise cannot resolve to undefined.
This error message can be updated here: |
To be honest, I wonder why is there such a constraint? Is |
Yes, I am curious about this constraint too. |
My apologies, I see the docs explain it thus:
Source: https://docs.cypress.io/api/commands/task.html#Command |
The code for this is done in cypress-io/cypress#6920, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
When running a task returning promise that fulfils with undefined, we get an error with following message:
The task 'exampleAsyncTask' returned undefined. You must return a promise, a value, or null to indicate that the task was handled.
Desired behavior:
Cypress should either handle promises fulfilling to undefined, or give clear error message that it's not allowed (i.e.
The task 'exampleAsyncTask' returned promise fulfilling with undefined.
).Test code to reproduce
Test fails with:
Changing task promise to return any value fixes the issue:
Versions
Cypress 3.8.2
macOS 10.14.6
The text was updated successfully, but these errors were encountered: