-
-
Notifications
You must be signed in to change notification settings - Fork 955
chore: replace sinon with vitest's vi #4289
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
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
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.
Pull Request Overview
This PR replaces the use of the sinon
library with Vitest’s built-in vi
utility across test files.
- Swapped out all
sinon.spy()
/sinon.useFakeTimers()
calls forvi.fn()
/vi.useFakeTimers()
and restored timers withvi.useRealTimers()
. - Updated all assertion styles from Sinon/Vendor syntax (
to.have.been.called
,to.have.callCount
) to Vitest matchers (toHaveBeenCalled()
,toHaveBeenCalledTimes()
). - Added
vi
to Vitest imports where needed and removed unusedsinon
imports.
Reviewed Changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/CascadeTree/test/TreeView.spec.tsx | Replaced sinon.spy() with vi.fn() and updated assertions |
src/CascadeTree/test/CascadeTree.spec.tsx | Swapped sinon spies for vi.fn() , migrated call count and mocks |
src/Carousel/test/Carousel.spec.tsx | Converted sinon.spy() to vi.fn() and updated assertion syntax |
src/Calendar/test/CalendarTimeDropdown.spec.tsx | Replaced sinon.spy() with vi.fn() and updated matchers |
src/Calendar/test/CalendarMonthDropdownItem.spec.tsx | Swapped in vi.fn() for spies, updated call assertions |
src/Calendar/test/CalendarMonthDropdown.spec.tsx | Replaced sinon spies with vi.fn() and migrated matchers |
src/Calendar/test/CalendarHeader.spec.tsx | Converted sinon spies to vi.fn() and updated assertions |
src/Calendar/test/CalendarGridRow.spec.tsx | Replaced sinon.spy() with vi.fn() and updated assertion style |
src/Calendar/test/CalendarGridCell.spec.tsx | Swapped out sinon for vi.fn() and updated call assertions |
src/Calendar/test/CalendarContainer.spec.tsx | Migrated sinon.spy() to vi.fn() , adjusted assertion matchers |
src/Calendar/test/Calendar.spec.tsx | Replaced sinon timers and spies with vi.useFakeTimers() , vi.fn() , and updated assertions |
src/Button/test/Button.spec.tsx | Entire file deleted (Button tests removed) |
src/Breadcrumb/test/BreadcrumbItem.spec.tsx | Swapped sinon.spy() for vi.fn() and migrated assertions |
src/Breadcrumb/test/Breadcrumb.spec.tsx | Replaced sinon spies with vi.fn() , updated console spy usage |
src/AutoComplete/test/utils.spec.ts | Removed sinon , added vi , and updated filter test assertions |
src/AutoComplete/test/AutoComplete.spec.tsx | Converted sinon.spy() to vi.fn() and updated assertion syntax |
src/Animation/test/Transition.spec.tsx | Entire file deleted (Transition tests removed) |
src/Animation/test/Collapse.spec.tsx | Swapped sinon spy for vi.fn() and updated assertions |
src/Affix/test/Affix.spec.tsx | Replaced sinon.spy() with vi.fn() and updated assertions |
src/Accordion/test/Accordion.spec.tsx | Swapped sinon spies for vi.fn() and updated expectation calls |
Comments suppressed due to low confidence (2)
src/Button/test/Button.spec.tsx:1
- The Button.spec.tsx file was deleted, removing all Button component tests and reducing test coverage. Confirm if deletion was intentional or restore these tests.
<entire file removed>
src/Animation/test/Transition.spec.tsx:1
- The Transition.spec.tsx file has been removed, dropping all animation transition tests and potentially decreasing test coverage. Verify if this removal was intended.
<entire file removed>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #4289 +/- ##
==========================================
+ Coverage 94.14% 94.26% +0.12%
==========================================
Files 544 543 -1
Lines 13262 13243 -19
Branches 3951 3948 -3
==========================================
- Hits 12485 12484 -1
+ Misses 707 690 -17
+ Partials 70 69 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request focuses on replacing the usage of the
sinon
library with thevi
testing utility fromvitest
across multiple test files.