Skip to content

Conversation

@9aoy
Copy link
Contributor

@9aoy 9aoy commented Oct 23, 2025

Summary

add RSTEST_WORKER_ID environment variable.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@9aoy 9aoy requested review from Copilot October 23, 2025 05:28
@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 1044aba
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/68f9bd0df7c6470008b39317
😎 Deploy Preview https://deploy-preview-641--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the RSTEST_WORKER_ID environment variable to expose the worker ID to tests during execution. This allows tests to identify which worker they're running on, which can be useful for parallel execution scenarios and debugging.

  • Adds workerId to the WorkerContext type
  • Sets the RSTEST_WORKER_ID environment variable in the worker process based on the entry index
  • Includes a test to verify the environment variable is available

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/core/src/types/worker.ts Adds workerId field to WorkerContext type
packages/core/src/runtime/worker/index.ts Sets RSTEST_WORKER_ID environment variable from context
packages/core/src/pool/index.ts Passes workerId based on entry index to both test execution and collection
e2e/basic/test/index.test.ts Adds test to verify RSTEST_WORKER_ID is defined

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

options: {
entryInfo,
context: {
workerId: index + 1,
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Using array index + 1 as workerId is problematic because multiple entries can execute on the same worker in a pool. This creates inconsistent worker IDs where the same worker process gets different IDs for different tests. The workerId should represent the actual worker process identifier from the pool, not the test entry index.

Suggested change
workerId: index + 1,

Copilot uses AI. Check for mistakes.
options: {
entryInfo,
context: {
workerId: index + 1,
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

Using array index + 1 as workerId is problematic because multiple entries can execute on the same worker in a pool. This creates inconsistent worker IDs where the same worker process gets different IDs for different tests. The workerId should represent the actual worker process identifier from the pool, not the test entry index.

Suggested change
workerId: index + 1,
// workerId will be set by the worker process itself

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@9aoy 9aoy merged commit 68a402f into main Oct 23, 2025
17 checks passed
@9aoy 9aoy deleted the RSTEST_WORKER_ID branch October 23, 2025 06:14
@9aoy 9aoy mentioned this pull request Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants