test(element): migrate element-ng to vitest part 3#1707
Conversation
There was a problem hiding this comment.
Code Review
This pull request primarily focuses on migrating test files from Jasmine to Vitest, involving extensive changes across multiple Angular components. The migration includes replacing Jasmine's spyOn, createSpy, clock().install(), clock().tick(), and clock().uninstall() with Vitest's vi.spyOn, vi.fn(), vi.useFakeTimers(), vi.advanceTimersByTime(), and vi.useRealTimers() respectively. Additionally, expect().toHaveSize() is updated to expect().toHaveLength() for array size assertions. Configuration files like angular.json, tsconfig.spec.json, and tsconfig.vitest.json were updated to correctly include or exclude test files based on the new Vitest naming conventions. Several test setups were simplified by removing unnecessary imports and dependencies, such as TestHostComponent, SiFormlyNumberComponent, FormlyTestComponent, ReactiveFormsModule, SiDatepickerModule, and runOnPushChangeDetection. The SiFormlyComponent test setup was refactored to use signal-based inputs directly, eliminating the need for a wrapper component. Type safety was improved by replacing jasmine.Spy with Mock from Vitest and adding a type definition for translateSync in SiTranslateService mock.
Documentation.
Examples.
Dashboards Demo.
Playwright report.
Coverage Reports: