Skip to content

test(*): migrating to vitest - #17790

Merged
kdinev merged 154 commits into
masterfrom
sstoychev/migrate-vitest
Oct 20, 2026
Merged

kdinev merged 154 commits into
masterfrom
sstoychev/migrate-vitest

Conversation

@kdinev

@kdinev kdinev commented Oct 17, 2026

Copy link
Copy Markdown
Member

Closes #

Description

Motivation / Context

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

ChronosSF and others added 30 commits January 21, 2026 15:56
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
fix(lint): resolve parsing errors and style violations from vitest migration
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
fix(schematics): exclude spec files from build compilation
- Add expect import to calendar-helper-utils.ts
- Replace jasmine.getEnv() with vitest beforeEach/afterEach
- Replace jasmine.createSpyObj with vi.fn() based mocks
- Replace pending() with it.skip()
- Fix expect() message syntax for vitest (message before assertion)
- Remove deprecated exportExcel and exportCsv properties
- Remove deprecated moveable property from column definitions
- Fix mock emitter types to use any for compatibility

Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
- Add GridPagingMode import and use GridPagingMode.Remote for RemotePagingComponent
- Add GridSelectionMode import and use GridSelectionMode.none for MovableColumnsComponent
- Add GridColumnDataType import and properly type columns in IgxGridAdvancedFilteringDynamicColumnsComponent

Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
- Add isEditable, isHidden, isGroupable to MovableTemplatedColumnsComponent
- Add paging property to MovableColumnsLargeComponent

Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
fix(tests): Complete Vitest migration fixes for CI compilation errors
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
fix(tests): migrate expect assertion messages to Vitest format
rkaraivanov and others added 25 commits October 20, 2026 00:42
Navigation tests slept 60 ms after each click, key press and
navigateTo. Clicks need a frame and scrolls complete on the next
scroll event, so one or two frames are enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary navigation, scrolls and transaction updates slept 30-100 ms;
one or two animation frames are enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Edit mode focus (igxFocus focuses in requestAnimationFrame) and
scrolls slept 16-500 ms; one or two animation frames are enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scrolls slept 100 ms and key presses 30 ms; two frames and one frame
are enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Scrolls slept 100 ms and pointer moves 30-50 ms. Scrolls complete on
the next scroll event and pointer moves are throttled to one per
frame, so one or two frames are enough.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each row dimension cell creates its column with the standalone
createComponent on every rowData change and never destroyed it.
Angular tracks every live LView until it is destroyed, and the column
injects the grid, so each orphan pinned the whole grid, its DOM and
injector for the life of the page.

Keep the ref, destroy it when the row data replaces the column and
when the cell is destroyed (DestroyRef).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pivot grid regenerates its column hierarchy and row dimension
header columns with the standalone createComponent on every
configuration or data change, and in horizontal layout on every data
rebinding. Unlike the base grid it never destroyed the old refs, so
each column stayed in Angular's LView registry and pinned the grid.

Track the hierarchy refs in the base _autoGeneratedColsRefs, which
the base ngOnDestroy already destroys, and the dimension refs in a
private list destroyed via DestroyRef. Destroy both on regeneration.
This also frees the hidden measure columns that are created but
never used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Child grids build their columns from the row island columns with the
standalone createComponent() and never destroyed those refs. Angular
tracks every live LView and each column injects its grid, so a leaked
column kept the child grid, its DOM and the root grid alive for the
life of the page.

Keep the refs created by createColumnsList. Destroy the previous ones
once the row island columns change and the grid drops them, and the
rest when the grid is destroyed (DestroyRef).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setState creates the columns and column groups missing from the grid
with the standalone createComponent() and never destroyed them. Each
one injects a grid, so it kept the grid, its DOM and the test injector
alive for the life of the page.

The state directive owns these refs: it creates them with its own
injector, and grids have no API to adopt external refs (adding one
would be new public API). A later columns restore for the same grid
destroys the created columns that grid no longer uses; reused ones
stay. The rest are destroyed with the directive (DestroyRef), which
lives as long as its host grid. Columns created for a child grid that
is destroyed earlier are therefore released with the root grid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The library tsconfig reaches the probe through test-setup.ts, and
under strict checks the clearTimeout/clearInterval wrappers did not
match the merged DOM and Node overloads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a row view dies, the grid detaches its master-detail view so the
view can be moved to another row later. After that the view lives only
in the grid's detail cache and the dead outlet's cache. The grid's
destroy cleaned only live outlets, so detached views were never
destroyed and stayed in Angular's tracked view map, pinning their DOM
and component trees after the grid was gone.

Destroy the cached detail views when the grid is destroyed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each cell pointerdown adds a body pointerup listener that is removed
only by its own handler. If the grid is destroyed before a pointerup
reaches the body, the listener stays on the body and keeps the
selection service, and through it the grid, alive.

The service is provided per grid, so its DestroyRef ends with the grid.
Remove the listener there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a size change the row heights follow only once the rows'
resize observer reported and its 40 ms throttle fired. One frame was
enough alone but not under full-suite load. Wait two frames and
advance the throttle, as the other pivot resize specs do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After setting the keys, the records render once the grid re-measures.
One frame was enough alone but flaked under full-suite load. Poll for
the first record instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The browser suites build their specs from source, so they no longer
wait behind lint and the library, docs and elements builds. The
build job keeps the Node-only tests and the dist-based SSR checks.
Both browser jobs cache the Playwright Chromium by version and only
install its system dependencies on a cache hit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every igxFor instance, one per grid row, appended a probe to the body
and read its bounding rect to learn the engine's max element size.
Each probe forces a layout of the whole document, yet the value is an
engine constant that only changes with zoom.

Cache it per document, probe edge and device pixel ratio. A zero result
(no layout yet) is not cached, so a later instance probes again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every IgxIconService instance (one per injector, e.g. per TestBed)
parsed the same 33 built-in SVGs into XML documents in its constructor.

Keep the processed built-in markup in a module-level map keyed by
source text and reuse it across instances. It holds strings, so no DOM
is shared. Custom icons are still parsed per instance, keeping the map
bounded. Registration, events and output are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With the column and view leaks fixed, a test page peaks at about
1.5-2 GB instead of 3.5-4.5 GB. On a 12-core, 16 GB machine 6 workers
ran the suite in 165 s vs 194 s with 4, and 8 were no faster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
grid-filtering-ui.spec.ts ran ~80 s alone and set the floor of the
parallel suite, since Vitest parallelises by file. Split it into five
files of ~15-17 s each, balanced by per-test durations.

Describe nesting and titles are repeated in every file, so all 281 full
test names are unchanged. Helpers used by more than one file move to
test-utils/grid-filtering-functions.spec.ts; the rest stay local.

The Excel style filtering files that format 'fr-FR' dates now register
the fr locale themselves; the filtering row suite used to do it for the
whole file.

The filtering row split keeps "Should navigate from left arrow button
to first condition chip Tab." after its predecessor: run first on a
fresh page, its debounce (setTimeout) loses the race with nextFrame
and it fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Typing in the filter row goes through the input's debounceTime, a
0 ms timer in the Angular zone. The spec waited a frame, which can
fire before that timer on a fresh page, so the chip was never added
and the test only passed after other tests had run. whenStable waits
for the timer itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test element is pinned to the viewport's top-left corner, where
the headless browser's cursor rests. Once the element is laid out
under it, Chromium fires a trusted pointerover at (0, 0), which
switches the directive to the top-left scroll zone right after the
spec's synthetic event. Specs starting in another zone saw no or the
wrong deltas. pointer-events: none blocks the real hover; dispatched
events are not hit-tested, so the spec still drives the directive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kdinev
kdinev enabled auto-merge (squash) October 20, 2026 14:05

@ChronosSF ChronosSF left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ChronosSF
ChronosSF disabled auto-merge October 20, 2026 14:16
@kdinev
kdinev merged commit c73d3bf into master Oct 20, 2026
7 of 8 checks passed
@kdinev
kdinev deleted the sstoychev/migrate-vitest branch October 20, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants