Skip to content

chore: Add node_modules/dist to ignore + convert config to .ts #22852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 1, 2025

Conversation

emrysal
Copy link
Contributor

@emrysal emrysal commented Jul 31, 2025

What does this PR do?

In the logs of the tests there was a lot of mention of allowJs - primarily coming from the compiled /dist/ files, this addresses that (and hopefully speeds up the apiv2 tests a little)

@emrysal emrysal requested review from a team as code owners July 31, 2025 23:18
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Warning

Rate limit exceeded

@emrysal has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between aea6479 and 8d4031a.

📒 Files selected for processing (2)
  • apps/api/v2/jest-e2e.ts (1 hunks)
  • apps/api/v2/jest.config.ts (1 hunks)

Walkthrough

Two JSON Jest configuration files (jest-e2e.json and jest.config.json) were deleted from the apps/api/v2 directory. They were replaced by two new TypeScript-based Jest configuration files (jest-e2e.ts and jest.config.ts). The new TypeScript configuration files replicate and extend the settings from the previous JSON files, including module file extensions, root directory, module name mappings, test environment, test matching patterns, transform settings, setup files, reporters, memory and worker limits, and ignore patterns. The configurations are now exported as default TypeScript constants compatible with ts-jest. Additionally, the package.json test scripts for e2e testing were updated to reference the new TypeScript Jest configuration file instead of the deleted JSON file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

  • Complexity: Simple. The changes involve straightforward migration from JSON to TypeScript configuration files with minor adjustments in file extensions and structure.
  • Scope: Limited to configuration files and package scripts without impacting application or test logic.
  • Estimated review time: ~7 minutes.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/add-node-modules-and-dist-to-ignore-apiv2

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 generate unit tests to generate unit tests for 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.

@keithwillcode keithwillcode added core area: core, team members only foundation labels Jul 31, 2025
@emrysal emrysal enabled auto-merge (squash) July 31, 2025 23:19
@dosubot dosubot bot added the automated-tests area: unit tests, e2e tests, playwright label Jul 31, 2025
Copy link

vercel bot commented Jul 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Jul 31, 2025 11:41pm
cal-eu ⬜️ Ignored (Inspect) Jul 31, 2025 11:41pm

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: 2

🧹 Nitpick comments (5)
apps/api/v2/jest-e2e.ts (2)

12-14: Limit the transform to TypeScript only.

Transforming ‑even test-only JavaScript with ts-jest slows the suite ~20-30 % and yields no benefit.
If JS sources really need transpilation they should go through Babel, not the TypeScript compiler.

-  transform: {
-    "^.+\\.(t|j)s$": "ts-jest",
-  },
+  transform: {
+    "^.+\\.ts$": "ts-jest",
+  },

15-19: Duplicate config vs. jest.config.ts → extract a shared base.

Most fields (aliases, ignore patterns, ts-jest transform) are repeated verbatim in both config files.
A tiny helper such as jest.base.ts avoids drift and eliminates ~25 duplicated lines.

apps/api/v2/jest.config.ts (3)

11-14: Prefer testMatch over a bare RegExp for clarity.

testRegex is powerful but easy to mistype; a glob is clearer and consistent with community defaults.

-  testRegex: ".*\\.spec\\.ts$",
+  testMatch: ["**/?(*.)+(spec).ts"],

15-18: Align resource limits with the e2e config or document why they differ.

The e2e config pins workerIdleMemoryLimit and maxWorkers; the unit-test config does not.
Either propagate the same constraints or add a comment explaining the intentional difference to avoid future confusion.


15-18: Extract shared fields into a base config (DRY).

Alias mapping, ignore patterns and the ts-jest transform block are duplicated between this file and jest-e2e.ts. Centralising them reduces maintenance overhead.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9193221 and 9206cb2.

📒 Files selected for processing (4)
  • apps/api/v2/jest-e2e.json (0 hunks)
  • apps/api/v2/jest-e2e.ts (1 hunks)
  • apps/api/v2/jest.config.json (0 hunks)
  • apps/api/v2/jest.config.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/api/v2/jest.config.json
  • apps/api/v2/jest-e2e.json
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • apps/api/v2/jest.config.ts
  • apps/api/v2/jest-e2e.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/review.mdc)

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • apps/api/v2/jest.config.ts
  • apps/api/v2/jest-e2e.ts
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: For large pull requests (>500 lines changed or >10 files touched), advise splitting into smaller, focused PRs by feature, layer, dependency chain, or file/module
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.{service,repository}.ts : Avoid dot-suffixes like `.service.ts` or `.repository.ts` for new files; reserve `.test.ts`, `.spec.ts`, `.types.ts` for their specific purposes
📚 Learning: applies to **/*.{service,repository}.ts : avoid dot-suffixes like `.service.ts` or `.repository.ts` ...
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.{service,repository}.ts : Avoid dot-suffixes like `.service.ts` or `.repository.ts` for new files; reserve `.test.ts`, `.spec.ts`, `.types.ts` for their specific purposes

Applied to files:

  • apps/api/v2/jest.config.ts
📚 Learning: applies to **/*.{ts,tsx} : flag excessive day.js use in performance-critical code; prefer native dat...
Learnt from: CR
PR: calcom/cal.com#0
File: .cursor/rules/review.mdc:0-0
Timestamp: 2025-07-28T11:50:23.946Z
Learning: Applies to **/*.{ts,tsx} : Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js `.utc()` in hot paths like loops

Applied to files:

  • apps/api/v2/jest.config.ts
  • apps/api/v2/jest-e2e.ts
🔇 Additional comments (2)
apps/api/v2/jest-e2e.ts (1)

20-21: The ignore pattern blocks the whole /dist/ tree, not only node_modules/dist/.

Goal of the PR is to silence node_modules/**/dist/**.
With the current pattern any first-level dist/ folder under apps/api/v2/ will be skipped as well (e.g. production build artefacts we still want to test).

Consider:

-  testPathIgnorePatterns: ["/dist/", "/node_modules/"],
-  transformIgnorePatterns: ["/dist/", "/node_modules/"],
+  testPathIgnorePatterns: ["/node_modules/.*/dist/", "/node_modules/"],
+  transformIgnorePatterns: ["/node_modules/.*/dist/", "/node_modules/"],
apps/api/v2/jest.config.ts (1)

4-4: No .js test files detected—re-introducing “js” isn’t needed
Our search under apps/api/v2 found only configuration files in JavaScript, not any test/helpers:

  • apps/api/v2/.eslintrc.js
  • apps/api/v2/.prettierrc.js
  • apps/api/v2/next-i18next.config.js

There are no .js files in apps/api/v2/test or other source directories that Jest would pick up as tests. Removing "js" from moduleFileExtensions will not break any existing tests.

Likely an incorrect or invalid review comment.

Copy link

socket-security bot commented Jul 31, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedclassnames@​2.5.110010010079100

View full report

@emrysal emrysal merged commit c6b1920 into main Aug 1, 2025
38 of 39 checks passed
@emrysal emrysal deleted the chore/add-node-modules-and-dist-to-ignore-apiv2 branch August 1, 2025 00:02
Copy link
Contributor

github-actions bot commented Aug 1, 2025

E2E results are ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated-tests area: unit tests, e2e tests, playwright core area: core, team members only foundation ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants