Skip to content

Comments

feat: support get runtime config via rs.getConfig API#701

Merged
9aoy merged 1 commit intomainfrom
getConfig
Nov 18, 2025
Merged

feat: support get runtime config via rs.getConfig API#701
9aoy merged 1 commit intomainfrom
getConfig

Conversation

@9aoy
Copy link
Collaborator

@9aoy 9aoy commented Nov 18, 2025

Summary

support get runtime config via rs.getConfig API.

const config = rstest.getConfig();
console.log(config);

// will output:
// {
//   testTimeout: 5000,
//   hookTimeout: 10000,
//   clearMocks: false,
//   resetMocks: false,
//   restoreMocks: false,
//   maxConcurrency: 5,
//   retry: 0
// }

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings November 18, 2025 08:12
@netlify
Copy link

netlify bot commented Nov 18, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit ff8c722
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/691c2a7a7b146400076e5cf4
😎 Deploy Preview https://deploy-preview-701--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 a new rs.getConfig API that allows users to retrieve the current runtime configuration for their test files. This complements the existing rs.setConfig and rs.resetConfig APIs.

Key Changes:

  • Added getConfig() method to the RstestUtilities interface that returns a RuntimeOptions object containing runtime configuration values
  • Implemented getConfig() to return a defensive copy of the configuration, preventing external modifications
  • Updated test suite to validate the new API functionality

Reviewed Changes

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

Show a summary per file
File Description
packages/core/src/types/mock.ts Added type definition for the getConfig() method to the RstestUtilities interface
packages/core/src/runtime/api/utilities.ts Implemented getConfig() method that returns a new object with selected runtime configuration properties
website/docs/en/api/rstest/utilities.mdx Added English documentation for the new rstest.getConfig API with usage example
website/docs/zh/api/rstest/utilities.mdx Added Chinese documentation for the new rstest.getConfig API with usage example
e2e/test-api/setConfig.test.ts Updated test suite name to include getConfig and improved test assertions using helper methods
e2e/test-api/fixtures/setConfig.test.ts Added test case to verify getConfig() returns expected configuration values
examples/node/test/index.test.ts Added example usage of rs.getConfig() for demonstration purposes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@9aoy 9aoy merged commit 01daa7d into main Nov 18, 2025
23 checks passed
@9aoy 9aoy deleted the getConfig branch November 18, 2025 09:28
@9aoy 9aoy mentioned this pull request Nov 20, 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.

1 participant