Skip to content

Conversation

philippotto
Copy link
Member

Follow-up to #8479 etc. See comments in diff for motivation.

@philippotto philippotto requested a review from hotzenklotz May 16, 2025 13:09
@philippotto philippotto self-assigned this May 16, 2025
Copy link
Contributor

coderabbitai bot commented May 16, 2025

📝 Walkthrough

Walkthrough

This change introduces dedicated Vitest configuration files for different test types and updates the npm scripts in package.json to explicitly reference these configs. The main Vitest config is refactored to prevent accidental test execution. The GitHub Actions workflow is updated to use the new config file for frontend tests. No changes were made to exported or public entities beyond configuration exports.

Changes

Files/Group Change Summary
package.json Updated test scripts to use explicit Vitest config files via --config option, removing inline glob patterns.
.github/workflows/build_test_deploy.yml Updated frontend test command to use --config vitest_spec.config.ts instead of inline test file globs.
vitest.config.ts Refactored: exports a minimal config with a placeholder include pattern and a named config export; prevents accidental test runs.
vitest_spec.config.ts, vitest_e2e.config.ts, New configs: each imports the base config and overrides test.include for their respective test types (spec, e2e, screenshot, etc.).
vitest_screenshot.config.ts, vitest_wkorg_screenshot.config.ts New configs: each targets specific Puppeteer screenshot test patterns, inheriting from the base config.

Possibly related PRs

Suggested labels

testing

Poem

In the warren where the tests all hop,
Each config’s now got its own little shop.
No more globs left to roam,
Each script finds its home,
With carrots and code, the rabbits don’t stop!
🥕✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

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

🧹 Nitpick comments (1)
package.json (1)

89-91: Dedicated configs for e2e and screenshot tests—consider moving inline flags into config files
The new test-e2e, test-screenshot, and test-wkorg-screenshot scripts correctly point to their specific Vitest configs. The inline flags (--fileParallelism=false, --testTimeout, --hookTimeout) are shared across screenshot tests and could be declared directly within vitest_screenshot.config.ts and vitest_wkorg_screenshot.config.ts for cleaner CLI commands and single-source maintenance.

 "test-screenshot": "vitest --config vitest_screenshot.config.ts run --testTimeout=300000 --hookTimeout=20000",
 "test-wkorg-screenshot": "vitest --config vitest_wkorg_screenshot.config.ts run --testTimeout=300000 --hookTimeout=20000",

 "test-screenshot": "vitest --config vitest_screenshot.config.ts run",
 "test-wkorg-screenshot": "vitest --config vitest_wkorg_screenshot.config.ts run",

And add to each config:

// vitest_screenshot.config.ts
import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    testTimeout: 300_000,
    hookTimeout: 20_000,
  },
});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4f9fa99 and 0d33945.

📒 Files selected for processing (6)
  • package.json (1 hunks)
  • vitest.config.ts (2 hunks)
  • vitest_e2e.config.ts (1 hunks)
  • vitest_screenshot.config.ts (1 hunks)
  • vitest_spec.config.ts (1 hunks)
  • vitest_wkorg_screenshot.config.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
vitest_e2e.config.ts (1)
vitest.config.ts (1)
  • config (9-25)
vitest_spec.config.ts (1)
vitest.config.ts (1)
  • config (9-25)
vitest_wkorg_screenshot.config.ts (1)
vitest.config.ts (1)
  • config (9-25)
vitest_screenshot.config.ts (1)
vitest.config.ts (1)
  • config (9-25)
🔇 Additional comments (8)
vitest_e2e.config.ts (1)

1-10: Clean configuration separation for E2E tests

Good approach creating a dedicated configuration for E2E tests. This separation helps prevent accidental running of E2E tests that could affect the database, as mentioned in the base config comments.

vitest_screenshot.config.ts (1)

1-10: Good configuration for screenshot tests

This dedicated config file for Puppeteer screenshot tests follows the same pattern as the other configs, maintaining consistency while providing a specific test scope.

vitest_wkorg_screenshot.config.ts (1)

1-10: Appropriate configuration for WKORG screenshot tests

Good job further specializing the screenshot tests with a dedicated config for the WKORG-specific screenshot tests. This granular separation allows for more targeted test runs.

vitest_spec.config.ts (1)

1-10: Well-structured configuration for unit tests

This configuration for unit tests (*.spec.ts files) follows the same clean pattern as the other configs, completing the set of specialized test configurations.

vitest.config.ts (3)

4-9: Good documentation of the motivation for these changes

The comments clearly explain the reasoning behind this refactoring - preventing accidental execution of E2E tests that could affect the database. This context is valuable for other developers.


13-15: Effective safeguard against accidental test execution

Using a descriptive message in the include pattern is an elegant way to prevent accidental test runs. This ensures users must explicitly choose a test configuration.


25-27: Clean export structure

Good separation of the configuration object from the default export. This allows other config files to import and extend the base config while maintaining the proper Vitest configuration structure.

package.json (1)

85-87:

✅ Verification successful

Explicit spec Vitest config in npm scripts is a good improvement
The test, test-changed, and test-watch scripts now correctly reference vitest_spec.config.ts, centralizing all spec-test settings. Please ensure this config file lives at the repo root and that its glob patterns cover all intended spec tests.

Run this quick check to verify the config file exists:


🏁 Script executed:

#!/bin/bash
if [ ! -f vitest_spec.config.ts ]; then
  echo "ERROR: vitest_spec.config.ts not found"
  exit 1
fi

Length of output: 38


🏁 Script executed:

#!/bin/bash
# Verify that vitest_spec.config.ts lives at the repo root and display its include patterns
if [ -f vitest_spec.config.ts ]; then
  echo "✅ vitest_spec.config.ts found at repo root"
else
  echo "❌ vitest_spec.config.ts not found at repo root"
  exit 1
fi

echo -e "\n🔍 Glob patterns in vitest_spec.config.ts:"
grep -R "include" -n vitest_spec.config.ts || echo "No 'include' patterns found"

Length of output: 334


Vitest config verified at root with include patterns

  • vitest_spec.config.ts is located at the repository root.
  • 🔍 Its include patterns currently cover ./frontend/javascripts/test/**/*.spec.ts.

If this pattern encompasses all of your spec files, no further action is needed.

Copy link
Contributor

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

🧹 Nitpick comments (1)
.github/workflows/build_test_deploy.yml (1)

44-44: Use npm script alias for frontend tests
You’ve updated the workflow to point at the new Vitest config directly—which is perfect for clarity—but we already defined an npm script (e.g. test:spec) in package.json encapsulating this command. To avoid duplication and ensure consistency, consider replacing this line with:

run: yarn test:spec

This centralizes any future tweaks to the Vitest invocation in one place.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d33945 and 937d702.

📒 Files selected for processing (1)
  • .github/workflows/build_test_deploy.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: backend-tests
  • GitHub Check: build-smoketest-push

@philippotto philippotto merged commit d81c372 into master May 16, 2025
5 checks passed
@philippotto philippotto deleted the vitest-configs branch May 16, 2025 14:02
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