Skip to content

fix: persist test coverage sort order across sessions#304979

Merged
connor4312 merged 2 commits intomicrosoft:mainfrom
yogeshwaran-c:fix/coverage-sort-persist
Mar 26, 2026
Merged

fix: persist test coverage sort order across sessions#304979
connor4312 merged 2 commits intomicrosoft:mainfrom
yogeshwaran-c:fix/coverage-sort-persist

Conversation

@yogeshwaran-c
Copy link
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

The Test Coverage view's sort order resets to "Sort by Location" every time the view is reopened (e.g., after running tests without coverage and then re-running with coverage). The sort order selection is not persisted.

Closes #249442

What is the new behavior?

The sort order is now persisted to workspace storage using IStorageService. When the Test Coverage view is created, it reads the previously stored sort order. An autorun watcher saves the sort order to storage whenever it changes.

Additional context

Single file change: src/vs/workbench/contrib/testing/browser/testCoverageView.ts

  • Added IStorageService injection
  • Load stored sort order in constructor
  • Persist sort order changes via autorun in renderBody
  • Storage key: testing.coverageSortOrder (workspace scope, machine target)

TypeScript compilation passes with no errors.

The test coverage view's sort order was reset to 'Location' every time
the view was reopened because it was stored only in an in-memory
observable. Persist the sort order to workspace storage so it survives
across sessions.

Closes microsoft#249442
Use range comparison instead of 'in' operator for const enum check.
@connor4312 connor4312 enabled auto-merge (squash) March 26, 2026 16:07
@connor4312 connor4312 merged commit 6e1bad2 into microsoft:main Mar 26, 2026
42 of 51 checks passed
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.

Sorting is not persisted in Test Coverage

3 participants