Skip to content

refactor(ci): replace deprecated vitest spy assertion - #263

Open
2yunseong wants to merge 1 commit into
TanStack:mainfrom
2yunseong:fix/replace-deprecate-vitest-spy-assertion
Open

2yunseong wants to merge 1 commit into
TanStack:mainfrom
2yunseong:fix/replace-deprecate-vitest-spy-assertion

Conversation

@2yunseong

@2yunseong 2yunseong commented Sep 15, 2026

Copy link
Copy Markdown

🎯 Changes

Closes #262.

This PR replaces the following deprecated Vitest spy assertion aliases with their canonical equivalents:

  • toBeCalledtoHaveBeenCalled
  • toBeCalledTimestoHaveBeenCalledTimes
  • toBeCalledWithtoHaveBeenCalledWith

These are assertion-only replacements and do not change the existing test behavior.

Affected test files

  • packages/pacer/tests/async-debouncer.test.ts
  • packages/pacer/tests/debouncer.test.ts
  • packages/pacer/tests/throttler.test.ts
  • packages/pacer-lite/tests/lite-debouncer.test.ts
  • packages/pacer-lite/tests/lite-throttler.test.ts

Verification

  • packages/pacer: 555 tests passed
  • packages/pacer-lite: 223 tests passed
  • Confirmed that no usages of toBeCalled, toBeCalledTimes, or toBeCalledWith remain in the repository
image image

✅ Checklist

  • I have followed the steps in the Contributing guide
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Updated test assertions to use current Vitest matcher names.
    • Test coverage, scenarios, expected results, and runtime behavior remain unchanged.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 92eaf5ea-cddf-4e60-addf-268c8613658d

📥 Commits

Reviewing files that changed from the base of the PR and between 9233835 and eda891d.

📒 Files selected for processing (5)
  • packages/pacer-lite/tests/lite-debouncer.test.ts
  • packages/pacer-lite/tests/lite-throttler.test.ts
  • packages/pacer/tests/async-debouncer.test.ts
  • packages/pacer/tests/debouncer.test.ts
  • packages/pacer/tests/throttler.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The change replaces deprecated Vitest spy assertion aliases with canonical toHaveBeenCalled* equivalents across five debouncer and throttler test files. Assertion counts, arguments, timing, and test scenarios remain unchanged.

Changes

Vitest matcher migration

Layer / File(s) Summary
Lite debouncer assertions
packages/pacer-lite/tests/lite-debouncer.test.ts
Updated LiteDebouncer and liteDebounce tests to use canonical call, count, and argument matchers.
Lite throttler assertions
packages/pacer-lite/tests/lite-throttler.test.ts
Updated LiteThrottler and liteThrottle tests to use canonical call, count, and argument matchers.
Debouncer assertions
packages/pacer/tests/debouncer.test.ts
Updated Debouncer and debounce tests to use canonical spy matchers.
Async debouncer assertions
packages/pacer/tests/async-debouncer.test.ts
Updated async debouncer tests across promise, error, callback, control, and option scenarios.
Throttler assertions
packages/pacer/tests/throttler.test.ts
Updated Throttler and throttle tests to use canonical spy matchers.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor · Severity of issue fixed: Low

Suggested reviewers: kevinvandy

Merge Risk: ⚪ Minimal · up to eda89

This test-only migration preserves existing behavior and presents no material merge risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the assertion migration, affected files, verification results, checklist completion, and release impact. It satisfies the required template sections.
Title check ✅ Passed The title clearly identifies the refactor and replacement of deprecated Vitest spy assertions. The ci scope is slightly broad because the changes are limited to test files, but the title remains spe…
Linked Issues check ✅ Passed Issue #262 requires replacing deprecated Vitest toBe* spy aliases with toHaveBeen* equivalents while preserving assertions and test behavior. The PR updates the five listed test files, including n…
Out of Scope Changes check ✅ Passed The reported changes are limited to mechanical matcher updates in test files. The summary reports no exported or public entity changes and no published-code changes. The changes support issue #262 and…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

replace deprecated Vitest spy assertion aliases

1 participant