Skip to content

Introduce minimal linting for tests - #109

Merged
heavyrubberslave merged 2 commits into
mainfrom
feature/basic-test-linting
Aug 9, 2026
Merged

heavyrubberslave merged 2 commits into
mainfrom
feature/basic-test-linting

Conversation

@heavyrubberslave

@heavyrubberslave heavyrubberslave commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Tests

    • Expanded coverage for device removal, closure, discovery, event handling, settings lifecycle, and runtime edge cases.
    • Strengthened assertions for device notifications, persistence, protocol behavior, and transport events.
    • Clarified test descriptions and simplified assertion patterns for improved readability and consistency.
  • Chores

    • Added ESLint support for Vitest test files, including recommended rules and test-specific globals.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@heavyrubberslave, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e2c21429-28ff-4a0f-b567-62b91405c225

📥 Commits

Reviewing files that changed from the base of the PR and between f019b15 and da7ccf8.

📒 Files selected for processing (2)
  • tests/integration/deviceEvents.spec.ts
  • tests/unit/settings/settingsManager.spec.ts
📝 Walkthrough

Walkthrough

The pull request adds Vitest ESLint rules for TypeScript tests, extends JavaScript restrictions to test files, strengthens lifecycle and mock assertions, and corrects test descriptions across integration and unit test suites.

Changes

Vitest test quality

Layer / File(s) Summary
Vitest ESLint configuration
eslint.config.ts, package.json
Adds the Vitest ESLint plugin, test-specific globals and type-aware settings, recommended rules, and JavaScript restrictions for tests.
Behavior and exact-call assertions
tests/integration/deviceEvents.spec.ts, tests/unit/automation/scriptRuntime.spec.ts, tests/unit/device/..., tests/unit/settings/settingsManager.spec.ts
Adds explicit device lifecycle, no-throw, completion, and idempotency checks. Consolidates mock call-count and argument checks into exact-once assertions.
Test description cleanup
tests/unit/controller/..., tests/unit/device/...
Removes duplicated wording from test descriptions, clarifies reboot close timing, and simplifies selected assertions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: patch

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding minimal ESLint configuration for test files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/basic-test-linting

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/integration/deviceEvents.spec.ts`:
- Around line 124-125: Update the test around the existing getConnectedDevices()
length assertion to also verify that the remaining device’s getDeviceId matches
the expected non-target device identity after NEW_DEVICE_ID disconnects, while
preserving the existing length check.

In `@tests/unit/settings/settingsManager.spec.ts`:
- Around line 149-150: Replace the invalid toThrow assertions on stopWatching()
with a value-based promise assertion, such as resolves.toBeUndefined(), matching
its Promise<void> contract; retain both repeated stopWatching() calls to verify
repeated shutdown remains successful.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c150871-a927-4a73-a706-f4e20cfa6164

📥 Commits

Reviewing files that changed from the base of the PR and between dc45da5 and f019b15.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • eslint.config.ts
  • package.json
  • tests/integration/deviceEvents.spec.ts
  • tests/unit/automation/scriptRuntime.spec.ts
  • tests/unit/controller/getDevicesController.spec.ts
  • tests/unit/device/deviceManager.spec.ts
  • tests/unit/device/knownDeviceRegistry.spec.ts
  • tests/unit/device/protocol/airotic/airoticDevice.spec.ts
  • tests/unit/device/protocol/buttplugIo/buttplugIoDevice.spec.ts
  • tests/unit/device/protocol/estim2b/estim2bDevice.spec.ts
  • tests/unit/device/protocol/slvCtrlPlus/genericSlvCtrlPlusDevice.spec.ts
  • tests/unit/device/protocol/slvCtrlPlus/slvCtrlProtocolLegacy.spec.ts
  • tests/unit/device/protocol/slvCtrlPlus/slvCtrlProtocolV1.spec.ts
  • tests/unit/device/protocol/virtual/display/displayVirtualDevice.spec.ts
  • tests/unit/device/transport/bleObserver.spec.ts
  • tests/unit/device/transport/serialPortObserver.spec.ts
  • tests/unit/settings/settingsManager.spec.ts

Comment thread tests/integration/deviceEvents.spec.ts Outdated
Comment thread tests/unit/settings/settingsManager.spec.ts Outdated
- Assert remaining device identity, not just count, after device removal
- Fix invalid resolves.not.toThrow() pattern for Promise<void> assertions
@heavyrubberslave
heavyrubberslave merged commit afc381b into main Aug 9, 2026
7 checks passed
@heavyrubberslave
heavyrubberslave deleted the feature/basic-test-linting branch August 9, 2026 16:46
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.

1 participant