Skip to content
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

Mocking a module in CT should work #21681

Closed
sync-by-unito bot opened this issue May 30, 2022 · 4 comments
Closed

Mocking a module in CT should work #21681

sync-by-unito bot opened this issue May 30, 2022 · 4 comments
Labels
CT Issue related to component testing

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented May 30, 2022

Summary

Currently, mocking with cy.stub (via sinon) does not mock an exported named function (and perhaps value) from an imported module.

Users coming from other testing libraries (like Jest), are accustomed to being able to mock out these dependencies for their tests. Ideally, we should be able to support mocking to the same level as Jest.

Acceptance Criteria

Mocking a named export should work
The API should be intuitive (much like cy.stub or jest.fn now).

Resources

See this thread on slack: https://cypressio.slack.com/archives/C011BAPC614/p1637104236309500
Sample repo demonstrating the issue: https://github.com/elylucas/cypress-stub-function-issue

Open Pull Requests

┆Issue is synchronized with this Jira Task by Unito
┆author: Ely Lucas
┆epic: CT Post Unification Release
┆friendlyId: UNIFY-610
┆priority: Low
┆sprint: Backlog
┆taskType: Task

@sync-by-unito sync-by-unito bot added CT Issue related to component testing epic:ct-post-unification-release labels May 30, 2022
@sync-by-unito
Copy link
Author

sync-by-unito bot commented May 30, 2022

➤ Mark Noonan commented:

Per Jess Sachs we will come back to this but after 10.0

@rockhold
Copy link

This seems related to a recently opened issue #22355. Adding the link here for cross-reference. Some additional evaluation may show that we could close one out if there is complete overlap. This came over from our Jira issues with a 'Low' priority, but it seems that we may want to bump that up and consider reprioritizing. Both Jess and Lachlan have raised this issue up internally. Tagging @baus for visibility for when he's back next week.

@FelipeLahti
Copy link

Related to #20008 as well

@lmiller1990
Copy link
Contributor

Close as dup of #22355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CT Issue related to component testing
Projects
None yet
Development

No branches or pull requests

3 participants