chore: Add node_modules/dist to ignore + convert config to .ts#22852
chore: Add node_modules/dist to ignore + convert config to .ts#22852
Conversation
|
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 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. 📒 Files selected for processing (2)
WalkthroughTwo JSON Jest configuration files ( Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes
✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
There was a problem hiding this comment.
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-jestslows 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 asjest.base.tsavoids drift and eliminates ~25 duplicated lines.apps/api/v2/jest.config.ts (3)
11-14: PrefertestMatchover a bare RegExp for clarity.
testRegexis 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
workerIdleMemoryLimitandmaxWorkers; 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
📒 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 useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
apps/api/v2/jest.config.tsapps/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.tsapps/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.tsapps/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 onlynode_modules/dist/.Goal of the PR is to silence
node_modules/**/dist/**.
With the current pattern any first-leveldist/folder underapps/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.jstest 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
.jsfiles in apps/api/v2/test or other source directories that Jest would pick up as tests. Removing"js"frommoduleFileExtensionswill not break any existing tests.Likely an incorrect or invalid review comment.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
E2E results are ready! |
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)