Closed cowboyd closed 1 year ago
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.
Current behavior
@bigtest/cypress
registers anexpect
command in order to make interactor-based assertions. This works well, except when you try to mix interactor assertions with vanilla cypress assertions using theshould()
syntax, in which case, they break.cy.expect
is not part of the public API, nor is it part of the TypeScript typings and in all of the documentation, the recommendation is to use the globalexpect()
function for BDD style assertions, but when anexpect
command is added, it causesshould()
style assertions to break because internally cypress is neither consuming it as a global, nor an es module, but as a property on the globalcy
object.https://github.com/cypress-io/cypress/blob/61aa287c459d5aeb88405818c1c6519988e20275/packages/driver/src/cy/commands/asserting.js#L31
Desired behavior
In this situation, Cypress should consume this function as a normal JavaScript module so that there is no hidden conflict with the command namespace. The style of consuming a module as a property of a global object was common before the era of modern bundling and especially the predominance of ES modules, but they give rise to hidden gotchas like this one.
Test code to reproduce
https://github.com/cowboyd/cypress-test-tiny/tree/expect-command
Cypress Version
Other
No response