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

Verify that mocks are properly tidied up #5304

Open
2 tasks
romaricpascal opened this issue Sep 10, 2024 · 2 comments
Open
2 tasks

Verify that mocks are properly tidied up #5304

romaricpascal opened this issue Sep 10, 2024 · 2 comments

Comments

@romaricpascal
Copy link
Member

What

Check that our tests that use mocks from Jest tidy these mocks appropriately, especially when spying on global functions with jest.spyOn.

Why

This would reduce the risk of a mock leaking from one test to another.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

  • Tests have been reviewed for usage of mocks
  • Relevant mocks are tidied up appropriately
@romaricpascal romaricpascal added awaiting triage Needs triaging by team javascript small story and removed awaiting triage Needs triaging by team labels Sep 10, 2024
@colinrotherham
Copy link
Contributor

Good to configure jest.config.mjs with resetModules: true and restoreMocks: true

Didn't realise at the time or I wouldn't have needed to clear things manually:

@romaricpascal
Copy link
Member Author

Nice! Thanks for digging these options, and no worries for not adding them at the time, it's the kind of small things that easily slips through (especially as it doesn't have a big impact on our tests for now) 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants