Document Promise.reject() as anti-pattern

This issue has been tracked since 2021-10-20.

RE: cypress-io/cypress#18557

My example code in the aforementioned issue uses resolve and reject. My thinking was that retry would continue even on reject but that's not the case. The correct usage is to only use resolve(true) and resolve(false), but error handling could be improved both by Cypress and this plugin.

Should there be a .catch() block added here? https://github.com/NoriSte/cypress-wait-until/blob/master/src/index.js#L75

NoriSte wrote this answer on 2021-10-28

Hey
Thanks for reporting and the details! I'll fix it but not anytime soon, PRs are welcome ❤️
Thanks
Stefano

NoriSte wrote this answer on 2021-10-31

Should there be a .catch() block added here? https://github.com/NoriSte/cypress-wait-until/blob/master/src/index.js#L75

No, because checkFunction is passed to the plugin, so if I add a catch block results in result.then(...).catch is not a function.

I'll add some words in the README, though.

NoriSte wrote this answer on 2021-10-31

I changed my mind. calling reject() is the same as throwing an error. It's reasonable, in my opinion, that it bubbles up to Cypress.

Thanks for reporting! Feel free to re-open it if you think it makes sense.
Stefano

More Details About Repo
Owner Name NoriSte
Repo Name cypress-wait-until
Full Name NoriSte/cypress-wait-until
Language JavaScript
Created Date 2019-04-27
Updated Date 2023-03-19
Star Count 635
Watcher Count 8
Fork Count 24
Issue Count 3

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date