Skip to content

Feature/test config#16

Closed
AndrewHanasiro wants to merge 2 commits intomainfrom
feature/test-config
Closed

Feature/test config#16
AndrewHanasiro wants to merge 2 commits intomainfrom
feature/test-config

Conversation

@AndrewHanasiro
Copy link
Member

@AndrewHanasiro AndrewHanasiro commented Dec 17, 2025

Summary by CodeRabbit

  • New Features

    • Test coverage measurement now runs automatically with unit tests.
  • Documentation

    • Added Known Vulnerabilities security badge to README.
  • Tests

    • Added comprehensive test suite for Modal component, covering rendering, event emission, and keyboard interactions.
  • Chores

    • Updated development dependencies to latest versions.
    • Modified test output directory structure.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

Test infrastructure and dependencies updated across configuration files, package.json, and tooling. Added coverage tracking to .gitignore, updated test scripts to include coverage reporting, modified JUnit output paths, added coverage configuration for Vite, introduced new Modal component test suite, and bumped devDependencies including Vitest, ESLint, Svelte, and related tooling.

Changes

Cohort / File(s) Summary
Test & Build Configuration
package.json, playwright.config.ts, vite.config.ts, .gitignore
Updated test scripts to run with coverage via vitest run --coverage; changed JUnit output path from results.xml to test-results/results.xml; added Vite coverage configuration with v8 provider for e2e tests; added coverage entry to .gitignore
Dependency Updates
package.json
Bumped multiple devDependencies: @eslint/js, @vitest/browser*, eslint, prettier-plugin-svelte, sass-embedded, svelte, typescript-eslint, vite, vitest to newer patch/minor versions; added @vitest/coverage-v8 ^4.0.16
Documentation
README.md
Added Known Vulnerabilities badge/link near top of file
Test Suite
src/routes/Menu.spec.ts
Introduced new test suite for Modal component covering: rendering behavior, slot content verification, close event emission (button/overlay clicks), event suppression on content click, and Escape key handling

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • vite.config.ts coverage configuration: Verify the include/exclude patterns correctly target e2e tests and exclude unit/spec tests
  • package.json test script changes: Confirm output path changes (test-results/results.xml) align with CI/CD expectations
  • src/routes/Menu.spec.ts: Review test logic for Modal component interactions, particularly stopPropagation and Escape key handling
  • Dependency bumps: Confirm all updates (especially Svelte 5.46.0 and ESLint 9.39.2) are compatible with existing code

Possibly related PRs

  • feat: update #14: Modifies the same test/config and repo files (package.json, playwright.config.ts, vite.config.ts, .gitignore) for test reporting and coverage path adjustments.
  • featute/update-packages #13: Updates package.json devDependency versions in a similar pattern.

Poem

🐰 Modal tests are shining bright,
Coverage tracked with newfound sight,
Dependencies dance—a minor hop,
Building blocks that never stop!
From badges bold to paths anew,
The suite moves forward, tried and true.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is missing entirely. The required template sections for 'Proposal' and 'Links' are not filled in. Add a description following the repository template, explaining the test configuration changes, motivation for updating dependencies, and any relevant links to issues or documentation.
Title check ❓ Inconclusive The title is vague and overly generic. 'Feature/test config' does not clearly convey what specific test configuration changes were made or their purpose. Replace with a more specific title that describes the actual changes, such as 'Add test coverage configuration and update test scripts' or 'Configure test coverage and update Playwright output paths'.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/test-config

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/routes/Menu.spec.ts (1)

22-93: Consider renaming for consistency.

The test file is named Menu.spec.ts and imports from ./Menu.svelte, but the tests describe modal component behavior (dialog role, overlay, close button, Escape key). This naming inconsistency could cause confusion.

Consider either:

  1. Renaming Menu.svelte to Modal.svelte if it's primarily a modal component
  2. Or updating the test descriptions to reference "Menu" instead of "Modal" if Menu is the correct name

Otherwise, the test coverage is comprehensive and well-structured, covering:

  • Conditional rendering
  • User interactions (click, keyboard)
  • Event dispatching
  • Event propagation behavior
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00da970 and 84113cb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • .gitignore (1 hunks)
  • README.md (1 hunks)
  • package.json (1 hunks)
  • playwright.config.ts (1 hunks)
  • src/routes/Menu.spec.ts (1 hunks)
  • vite.config.ts (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Continuous Integration on Pull Request
src/routes/Menu.spec.ts

[error] 1-1: Cannot find package '@testing-library/svelte' imported from '/home/runner/work/auth-plus-client/auth-plus-client/src/routes/Menu.spec.ts'

🪛 GitHub Check: Test
src/routes/Menu.spec.ts

[failure] 1-1: [server] src/routes/Menu.spec.ts
Error: Cannot find package '@testing-library/svelte' imported from '/home/runner/work/auth-plus-client/auth-plus-client/src/routes/Menu.spec.ts'
❯ src/routes/Menu.spec.ts:1:1

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'ERR_MODULE_NOT_FOUND' }

🔇 Additional comments (7)
.gitignore (1)

3-3: LGTM!

Adding the coverage directory to .gitignore is appropriate for the new coverage tracking setup introduced in this PR.

README.md (1)

5-6: LGTM!

Adding the Snyk vulnerability badge provides good visibility into the project's security posture.

playwright.config.ts (1)

9-9: LGTM!

The JUnit output path update correctly aligns with the corresponding change in the package.json test script.

package.json (3)

15-16: LGTM!

The test script updates correctly enable coverage reporting and align with the JUnit output path changes in playwright.config.ts.


31-31: LGTM!

Adding @vitest/coverage-v8 is necessary for the coverage functionality enabled in the test:unit script.


21-46: These are routine patch and minor version updates within caret ranges. ESLint 9.39.2 contains only bug fixes, and Vitest 4.0 has breaking changes documented in a migration guide, but the update from 4.0.15 to 4.0.16 is a patch release with no breaking changes. Svelte 5 components written for Svelte 4 will continue to work, with minor exceptions, and existing apps should primarily see performance improvements. All updates are compatible with existing caret ranges and require no action.

src/routes/Menu.spec.ts (1)

7-20: SlotWrapper approach is a documented workaround for testing slots, but consider whether it aligns with your project's component model.

@testing-library/svelte does not have a way to pass in slot content directly in tests, and creating a separate wrapper component is the recommended workaround. Your SlotWrapper implementation follows this pattern.

However, verify that this approach is compatible with your codebase: Svelte 3/4 syntax works in Svelte 5 in legacy mode, but once a component uses runes, legacy mode features are no longer available. If your test file or the Menu component uses runes, this pattern may need adjustment. Consider checking whether you're using legacy mode or Svelte 5 runes throughout the codebase.

@@ -0,0 +1,93 @@
import { render, screen, fireEvent } from '@testing-library/svelte'
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Missing required dependency: @testing-library/svelte

The test imports @testing-library/svelte but this package is not listed in package.json devDependencies. This is causing the pipeline failure.

Add the dependency to package.json:

"devDependencies": {
  "@testing-library/svelte": "^5.2.7",
  ...
}

Then run npm install to install the package.

🧰 Tools
🪛 GitHub Actions: Continuous Integration on Pull Request

[error] 1-1: Cannot find package '@testing-library/svelte' imported from '/home/runner/work/auth-plus-client/auth-plus-client/src/routes/Menu.spec.ts'

🪛 GitHub Check: Test

[failure] 1-1: [server] src/routes/Menu.spec.ts
Error: Cannot find package '@testing-library/svelte' imported from '/home/runner/work/auth-plus-client/auth-plus-client/src/routes/Menu.spec.ts'
❯ src/routes/Menu.spec.ts:1:1

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'ERR_MODULE_NOT_FOUND' }

🤖 Prompt for AI Agents
In src/routes/Menu.spec.ts around line 1 the test imports
@testing-library/svelte but that package is missing from package.json
devDependencies; add "@testing-library/svelte": "^5.2.7" (or the desired
compatible version) to devDependencies in package.json and run npm install (or
yarn install) to install it, then re-run the pipeline/tests.

Comment on lines +8 to +12
coverage: {
provider: 'v8',
include: ['src/**/*.{e2e}.{js,ts}'],
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}']
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Coverage include pattern only targets test files, not source code.

The include pattern ['src/**/*.{e2e}.{js,ts}'] will only match files with .e2e. in their filename (e.g., example.e2e.js), which are test files, not production source code. Coverage should measure which source files are executed by your tests, not the test files themselves.

Apply this diff to fix the coverage configuration:

 coverage: {
   provider: 'v8',
-  include: ['src/**/*.{e2e}.{js,ts}'],
-  exclude: ['src/**/*.svelte.{test,spec}.{js,ts}']
+  include: ['src/**/*.{js,ts,svelte}'],
+  exclude: ['src/**/*.{test,spec,e2e}.{js,ts}', 'src/**/*.svelte.{test,spec}.{js,ts}']
 },

This will:

  • Include all source files for coverage tracking
  • Exclude all test/spec/e2e files from coverage reports
🤖 Prompt for AI Agents
In vite.config.ts around lines 8 to 12, the coverage include pattern currently
matches only test files (e.g., *.e2e.*) instead of source files; change the
include to target all source files (e.g., src/**/*.{js,ts,svelte}) and update
the exclude to filter out test/spec/e2e files (e.g., **/*.test.*, **/*.spec.*,
**/*.e2e.*) so coverage measures source code while excluding test files.

@AndrewHanasiro
Copy link
Member Author

done in another PR

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