Skip to content

Make analytics storage timing test deterministic#8091

Draft
alfonso-noriega wants to merge 1 commit into
mainfrom
maintenance-deterministic-analytics-storage
Draft

Make analytics storage timing test deterministic#8091
alfonso-noriega wants to merge 1 commit into
mainfrom
maintenance-deterministic-analytics-storage

Conversation

@alfonso-noriega

@alfonso-noriega alfonso-noriega commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

The analytics storage unit test used a real setTimeout to create elapsed time before completing a timing. That makes the test slower than necessary and less deterministic.

WHAT is this pull request doing?

Replaces the real timer wait with Vitest fake timers and an explicit system time advance. The test now asserts the exact recorded duration.

How to test your changes?

pnpm --dir packages/cli-kit vitest src/private/node/analytics/storage.test.ts
pnpm --dir packages/cli-kit lint
pnpm --dir packages/cli-kit type-check

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • This change is not user-facing; no changeset is needed.

Assisted-By: devx/d9c9b8a1-2521-4fdd-af59-d77381c6f0ee

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant