Skip to content
Source
Sign inSign up
TanStack/pacer

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

Open2yunseong(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/263/headopened

🎯 Changes

Closes #262.

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

  • toBeCalled → toHaveBeenCalled
  • toBeCalledTimes → toHaveBeenCalledTimes
  • toBeCalledWith → toHaveBeenCalledWith

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.
    1. 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 9233835f9ce19ca2fddabb6de789794bf4c15b96 and eda891d508b7a05eb8782627dd0ba5cd480ebbdb.

      📒 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 nameStatusExplanation
      Description check✅ PassedThe description clearly explains the assertion migration, affected files, verification results, checklist completion, and release impact. It satisfies the required template sections.
      Title check✅ PassedThe 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✅ PassedIssue #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✅ PassedThe 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✅ PassedNo 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 in to join this conversation.