-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Refactoring the setupTests.ts from Jest to vitest #2931
base: develop-postgres
Are you sure you want to change the base?
Refactoring the setupTests.ts from Jest to vitest #2931
Conversation
WalkthroughThis pull request focuses on refactoring the Changes
Assessment against linked issues
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/setupTests.ts (2)
13-14
: Consider a dedicated test utility for console errors
Overridingglobal.console.error
is a valid strategy to ensure errors inside tests fail the test suite. However, constant overrides might hide certain logging details. If needed, use a specialized logger or a test utility that mocks console methods more selectively, restoring them after tests finish.
18-18
: Same caution with console warnings
Similarly, overridingconsole.warn
to throw can be beneficial for test rigor. Just ensure it does not obscure relevant output.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/setupTests.ts
(1 hunks)
🔇 Additional comments (8)
src/setupTests.ts (8)
1-1
: Check consistency of package name in comment vs. actual import
The comment suggests "vitest-dom," yet the import is from @testing-library/jest-dom
. If you're fully transitioning to Vitest, consider whether this import should be changed to match a Vitest-compatible DOM library (e.g., vitest-dom
) or if the existing @testing-library/jest-dom
is intended.
7-7
: Correct usage of Vitest utilities
The import of vi
from 'vitest' is appropriate. Good job on initiating the actual framework transition here.
10-11
: Global fetch mocking looks good
Using vi.fn()
is the correct approach in Vitest to mock global methods.
22-22
: Fine approach to mock muted
setter
Protecting the muted
setter from potentially throwing or playing media is a neat way to isolate your tests from browser-related side effects.
27-29
: Global imports
Importing global CSS and scripts is usually safe for integration or end-to-end tests. For unit tests, confirm whether these imports are actually necessary, as they can slow down test runs or cause unexpected side effects.
33-33
: Check usage of jestPreviewConfigure
While the library name is "jest-preview," it's being used in a Vitest setup. Make sure there's no conflict or alternative configuration needed to align with Vitest’s recommended patterns.
35-35
: Configuration approach
Enabling autoPreview
can be helpful for debugging failing test cases. Just verify that it integrates correctly with Vitest.
41-42
: Large test timeout
The new test timeout is set to 400 seconds. Confirm if this extended timeout is genuinely required. Extended timeouts might mask performance issues or unresponsive tests.
Please fix the failing test |
@AQIB-NAWAB Please fix the conflicting file changes |
Please ask the Talawa Admin slack channel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the conflicting files.
What kind of change does this PR introduce?
refactoring
Issue Number:
Fixes #2753
Did you add tests for your changes?
No
Have you read the contributing guide?
Yes
Summary by CodeRabbit