Skip to content

feat: add RSTEST flag#405

Merged
9aoy merged 6 commits intomainfrom
rstest-flag
Jul 22, 2025
Merged

feat: add RSTEST flag#405
9aoy merged 6 commits intomainfrom
rstest-flag

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Jul 21, 2025

Summary

process.env.RSTEST can be used to determine if it is an rstest environment.

if (process.env.RSTEST) {
   // do something...
}

Related Links

Checklist

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

@netlify
Copy link
Copy Markdown

netlify bot commented Jul 21, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 7d99584
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/687f09ba9b009d000800ce3b
😎 Deploy Preview https://deploy-preview-405--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
Copy Markdown
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

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

  1. Can you document this feature
  2. Will this work for child process?

@chenjiahan chenjiahan requested a review from Copilot July 22, 2025 03:45
Copy link
Copy Markdown
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 environment variable flag to help developers detect when their code is running in an Rstest environment and apply different configurations accordingly.

  • Adds process.env.RSTEST flag that is set to 'true' during Rstest execution
  • Updates documentation in both English and Chinese to explain usage of the new flag
  • Includes test coverage to verify the flag works correctly in both config files and test files

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/cli/prepare.ts Sets process.env.RSTEST = 'true' during CLI preparation
website/docs/en/guide/basic/configure-rstest.mdx Documents the new RSTEST flag usage in English
website/docs/zh/guide/basic/configure-rstest.mdx Documents the new RSTEST flag usage in Chinese
website/docs/en/config/test/includeSource.mdx Updates recommendation from undefined to false for production builds
website/docs/zh/config/test/includeSource.mdx Updates recommendation from undefined to false for production builds
tests/cli/index.test.ts Adds test to verify RSTEST flag works in config files
tests/cli/fixtures/flag.config.ts Test fixture that validates RSTEST flag presence
tests/basic/test/index.test.ts Adds test to verify RSTEST flag is available in test environment

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@9aoy 9aoy merged commit 8fc95a2 into main Jul 22, 2025
16 checks passed
@9aoy 9aoy deleted the rstest-flag branch July 22, 2025 06:03
@9aoy 9aoy mentioned this pull request Jul 24, 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.

3 participants