-
Notifications
You must be signed in to change notification settings - Fork 54
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
feat: support parallel tests #287
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Warning Rate limit exceeded@fengmk2 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 14 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 (1)
WalkthroughThis update modifies the continuous integration configuration and test execution logic to enable parallelized testing. The CI workflow now uses a new testing action with a parallelization parameter, and a new dependency is added to support this functionality. Additionally, the test command is updated to split test files based on the current CI job index, and a new test case has been introduced to verify the correct distribution of tests. Changes
Sequence Diagram(s)sequenceDiagram
participant CI as CI Workflow
participant Test as Test Command
participant CP as ciParallelVars
participant TR as Test Runner
CI->>Test: Trigger test job with CI_NODE_INDEX & CI_NODE_TOTAL
Test->>CP: Retrieve parallel variables (index, total)
CP-->>Test: Return parallel execution details
Test->>Test: Slice test files based on CI job index
Test->>TR: Execute selected test files
TR-->>Test: Return test results
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/commands/test.ts (1)
9-10
: Consider adding type definitions.The ts-expect-error comment suggests missing types. Consider creating and contributing type definitions for ci-parallel-vars.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.github/workflows/nodejs.yml
(1 hunks)package.json
(1 hunks)src/commands/test.ts
(2 hunks)test/commands/test.test.ts
(1 hunks)
🔇 Additional comments (4)
package.json (1)
26-26
: LGTM! Good choice of dependency.The ci-parallel-vars package is a reliable choice for managing test parallelization in CI environments.
.github/workflows/nodejs.yml (1)
12-12
: LGTM! Good parallel job configuration.The changes effectively enable parallel testing:
- Using node-test-parallel.yml action
- Setting 4 parallel jobs is a good balance between speed and resource usage
Also applies to: 16-16
src/commands/test.ts (1)
171-171
: LGTM! Variable declaration change.Changing from const to let is necessary for the parallel execution logic.
test/commands/test.test.ts (1)
23-39
: LGTM! Comprehensive test coverage.The test case effectively verifies parallel execution:
- Tests environment variable handling
- Validates file splitting logic
- Checks execution output and success
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/nodejs.yml (1)
16-17
: Consider removing redundant action_ref parameter.The
action_ref
parameter appears redundant since the action is already referenced with@test-parallel
. This could lead to maintenance issues if the values get out of sync.uses: node-modules/github-actions/.github/workflows/node-test-parallel.yml@test-parallel with: os: 'ubuntu-latest, macos-latest, windows-latest' version: '18.19.0, 18, 20, 22, 23' parallel: 4 - action_ref: 'test-parallel'
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #287 +/- ##
==========================================
+ Coverage 95.79% 95.85% +0.05%
==========================================
Files 22 22
Lines 1070 1085 +15
Branches 170 172 +2
==========================================
+ Hits 1025 1040 +15
Misses 45 45 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this 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 (2)
test/fixtures/example-ts-cluster/test/index.test.ts (2)
7-16
: Consider the impact of debug logging on parallel test performance.While debug logging can be helpful, it might generate excessive output when running tests in parallel. Consider making it conditional based on a debug flag or environment variable.
- app.debug(); + if (process.env.DEBUG) { + app.debug(); + }Review the necessity of the fixed delay.
The 1-second delay after app.ready() seems arbitrary and could unnecessarily slow down parallel test execution. Consider:
- Using app events or health checks instead of a fixed delay
- Making the delay configurable
- Documenting why this specific delay is needed
Could you explain the rationale behind the 1-second delay? This might help identify a more optimal solution.
20-22
: Consider conditional logging for parallel test execution.While logging the request URL is helpful for debugging, it might generate excessive output when running tests in parallel. Consider making it conditional:
- console.log('request %s', url); + if (process.env.DEBUG) { + console.log('request %s', url); + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/nodejs.yml
(1 hunks)test/fixtures/example-ts-cluster/test/index.test.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/nodejs.yml
⏰ Context from checks skipped due to timeout of 90000ms (17)
- GitHub Check: Node.js / Test (windows-latest, 22, 1:2)
- GitHub Check: Node.js / Test (windows-latest, 22, 0:2)
- GitHub Check: Node.js / Test (windows-latest, 20, 1:2)
- GitHub Check: Node.js / Test (windows-latest, 20, 0:2)
- GitHub Check: Node.js / Test (windows-latest, 18, 1:2)
- GitHub Check: Node.js / Test (windows-latest, 18, 0:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 22, 1:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 22, 0:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 20, 1:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 20, 0:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 18, 1:2)
- GitHub Check: Node.js / Test (macos-latest, 20, 1:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 18, 0:2)
- GitHub Check: Node.js / Test (macos-latest, 22, 1:2)
- GitHub Check: Node.js / Test (macos-latest, 18, 0:2)
- GitHub Check: Node.js / Test (macos-latest, 20, 0:2)
- GitHub Check: Node.js / Test (macos-latest, 18, 1:2)
🔇 Additional comments (2)
test/fixtures/example-ts-cluster/test/index.test.ts (2)
1-1
: LGTM: Appropriate use of built-in Node.js scheduler.The scheduler import from node:timers/promises is correctly used for implementing the wait functionality.
5-5
: LGTM: Improved test identification for parallel execution.The more explicit test path in the describe block title helps with test identification when running tests in parallel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
test/ts.test.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (17)
- GitHub Check: Node.js / Test (windows-latest, 22, 1:2)
- GitHub Check: Node.js / Test (windows-latest, 22, 0:2)
- GitHub Check: Node.js / Test (windows-latest, 20, 1:2)
- GitHub Check: Node.js / Test (windows-latest, 18, 0:2)
- GitHub Check: Node.js / Test (windows-latest, 18, 1:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 22, 1:2)
- GitHub Check: Node.js / Test (windows-latest, 20, 0:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 20, 1:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 22, 0:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 20, 0:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 18, 1:2)
- GitHub Check: Node.js / Test (ubuntu-latest, 18, 0:2)
- GitHub Check: Node.js / Test (macos-latest, 22, 0:2)
- GitHub Check: Node.js / Test (macos-latest, 18, 1:2)
- GitHub Check: Node.js / Test (macos-latest, 20, 0:2)
- GitHub Check: Node.js / Test (macos-latest, 18, 0:2)
- GitHub Check: Node.js / Test (macos-latest, 20, 1:2)
[skip ci] ## [7.2.0](v7.1.0...v7.2.0) (2025-02-13) ### Features * support parallel tests ([#287](#287)) ([b3f2b6c](b3f2b6c))
closes #286
Summary by CodeRabbit
Chores
New Features
Tests