Skip to content

test: add Vitest projects, CI workflow, and new frontend/backend test suites - #789

Merged
rajnandan1 merged 12 commits into
rajnandan1:mainfrom
123FLO321:feat/test-setup
Jul 18, 2026
Merged

test: add Vitest projects, CI workflow, and new frontend/backend test suites#789
rajnandan1 merged 12 commits into
rajnandan1:mainfrom
123FLO321:feat/test-setup

Conversation

@123FLO321

@123FLO321 123FLO321 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This repo lacked tests completely.
This MR adds, frontend and backend testing suits and each one real test with CI integration.

requires #787

Summary by CodeRabbit

  • Tests

    • Added browser tests for CopyButton clipboard behavior and “Copied” UI feedback.
    • Added client tests for StatusBarCalendar tooltip content (including outage thresholds).
    • Added extensive server utility tests covering parsing, formatting, validation, and uptime calculations.
    • Introduced separate Vitest targets for server (Node) and client (browser), with shared client runtime mocks.
  • Chores

    • Added CI workflow to run tests on every push and pull request, including Playwright Chromium install and caching.
    • Standardized repository text normalization (LF) and updated local ignore rules.
  • Documentation

    • Updated development commands with new npm test scripts, plus the one-time Chromium install note.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ea472c7f-cc11-4aab-be84-d04c3c99d93d

📥 Commits

Reviewing files that changed from the base of the PR and between 01a428c and 385fb63.

📒 Files selected for processing (1)
  • .github/workflows/test.yml
 ____________________________________________
< Your function signature is a cry for help. >
 --------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
📝 Walkthrough

Walkthrough

Adds Vitest infrastructure for Node and Playwright browser tests, shared SvelteKit mocks, server utility coverage, component tests, repository setup updates, and GitHub Actions execution.

Changes

Vitest testing infrastructure

Layer / File(s) Summary
Repository test execution setup
.gitattributes, .gitignore, package.json, vite.config.ts, vitest-setup-client.ts, .github/workflows/test.yml, CLAUDE.md
Adds test scripts and dependencies, separates server and browser projects, mocks SvelteKit modules, configures Playwright Chromium execution, documents commands, and runs checks in CI.
Server utility coverage
src/lib/server/tool.test.ts
Tests timestamp, uptime, validation, string, secret, and monitor alert helpers with deterministic fixtures and mocked environment behavior.
Svelte component coverage
src/lib/components/*.svelte.test.ts
Tests clipboard behavior in CopyButton and tooltip, outage label, date, and latency rendering in StatusBarCalendar.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • rajnandan1/kener#790: Adds custom metric units whose behavior is exercised by the new component and server utility tests.

Poem

A rabbit hops through tests so bright,
With Chromium glowing in the night.
Server helpers, buttons too,
Find their paths in UTC blue.
Green checks nibble bugs away—
Hoppy code review today! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: new Vitest projects, CI workflow, and frontend/backend test suites.
✨ 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.

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds automated testing for the app. The main changes are:

  • Vitest server and browser test projects.
  • GitHub Actions workflow for checks and tests.
  • Component tests for CopyButton and StatusBarCalendar.
  • Server utility tests for timestamps, validation, parsing, and uptime helpers.
  • Shared browser-test setup for SvelteKit runtime mocks.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
vite.config.ts Adds separate Vitest projects for server tests and browser component tests.
src/lib/components/CopyButton.svelte.test.ts Adds browser tests for clipboard writes, copied state, callback handling, and empty text.
src/lib/components/StatusBarCalendar.svelte.test.ts Adds browser tests for calendar labeling and tooltip status output.
src/lib/server/tool.test.ts Adds server-side unit tests for time helpers, validators, string helpers, secrets, alerts, and uptime calculations.
vitest-setup-client.ts Adds shared SvelteKit runtime mocks for browser component tests.
.github/workflows/test.yml Adds CI steps for dependency install, Playwright Chromium setup, type checking, and tests.
package.json Adds test scripts and Vitest browser testing dependencies.

Reviews (5): Last reviewed commit: "ci: cancel superseded test runs on the s..." | Re-trigger Greptile

Comment thread vite.config.ts Outdated
Comment thread src/lib/components/CopyButton.svelte.test.ts

@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: 3

🤖 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 @.github/workflows/test.yml:
- Around line 13-14: Update the actions/checkout step to disable credential
persistence by setting persist-credentials to false, while leaving the existing
checkout action version unchanged.
- Around line 25-27: Update the “Get Playwright version” workflow step to query
the installed Playwright CLI for its version instead of reading the top-level
package-lock.json entry. Preserve the existing GitHub Actions output key,
playwright-version, so downstream steps continue receiving the version.

In `@src/lib/components/CopyButton.svelte.test.ts`:
- Line 24: Update the writeText assertion in the CopyButton test to use native
Vitest matchers: assert the argument with toHaveBeenCalledWith("copy-me") and
separately verify a single invocation with toHaveBeenCalledOnce().
🪄 Autofix (Beta)

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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 85cbbc3e-13a1-4f36-9bb8-5d2b5a39312f

📥 Commits

Reviewing files that changed from the base of the PR and between e5b745e and a7b5c2c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • .gitattributes
  • .github/workflows/test.yml
  • .gitignore
  • CLAUDE.md
  • package.json
  • src/lib/components/CopyButton.svelte.test.ts
  • src/lib/components/StatusBarCalendar.svelte.test.ts
  • src/lib/server/tool.test.ts
  • vite.config.ts
  • vitest-setup-client.ts

Comment thread .github/workflows/test.yml
Comment thread .github/workflows/test.yml Outdated
Comment thread src/lib/components/CopyButton.svelte.test.ts
@123FLO321 123FLO321 changed the title test: add test setup with some tests test: add Vitest projects, CI workflow, and new frontend/backend test suites Jul 14, 2026
Add a workflow-level concurrency group keyed by workflow + ref with
cancel-in-progress, so pushing a new commit cancels the still-running
test job for the previous commit on that branch/PR.
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@rajnandan1
rajnandan1 merged commit a937727 into rajnandan1:main Jul 18, 2026
3 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.

2 participants