Skip to content

test(element): migrate element-ng to vitest part 4#1709

Open
spliffone wants to merge 1 commit intomainfrom
test/vitest-part-h-l
Open

test(element): migrate element-ng to vitest part 4#1709
spliffone wants to merge 1 commit intomainfrom
test/vitest-part-h-l

Conversation

@spliffone
Copy link
Member

@spliffone spliffone commented Mar 21, 2026

@spliffone spliffone requested review from a team as code owners March 21, 2026 11:26
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request continues the migration of tests from Karma/Jasmine to Vitest. The changes primarily involve updating test files to use Vitest's mocking and timer APIs, and refactoring several test suites to align with modern Angular testing practices using signals and standalone component features. The configuration files are also updated to reflect the migration progress. The changes are generally good, but I have a couple of suggestions to improve code consistency and remove redundancy in the test setup, particularly regarding redundant change detection calls in async tests.

@@ -87,62 +115,61 @@ describe('SiLoginBasicComponent', () => {
passwordInput.dispatchEvent(new Event('input'));
fixture.detectChanges();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Angular async tests, avoid redundant fixture.detectChanges() calls after setting inputs when await fixture.whenStable() is already present, as whenStable() also triggers change detection. It's better to use await fixture.whenStable() here to trigger change detection and wait for async operations to complete, instead of fixture.detectChanges().

Suggested change
fixture.detectChanges();
await fixture.whenStable();
References
  1. In Angular async tests, avoid redundant fixture.detectChanges() calls after setting inputs when await fixture.whenStable() is already present, as whenStable() also triggers change detection.

@spliffone spliffone force-pushed the test/vitest-part-h-l branch from 6a40609 to cca0a6f Compare March 21, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant