Skip to content

Conversation

@9aoy
Copy link
Collaborator

@9aoy 9aoy commented Dec 12, 2025

Summary

Change the default output format from CommonJS to ES module format for Rstest.

This change makes ES modules the default module system, aligning with modern JavaScript standards.

Users can still opt-in to CommonJS format by explicitly setting output.module to false.

This change will make Rstest run more stably and avoid test failures due to issues with externalizing CommonJS modules.

close: #638

Checklist

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

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

netlify bot commented Dec 12, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 527b5ac
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/695b6b13d02b190008ffaae3
😎 Deploy Preview https://deploy-preview-763--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 changes the default output format from CommonJS to ES module format for Rstest. This is a breaking change that makes ES modules the default module system, aligning with modern JavaScript standards. Users can still opt-in to CommonJS format by explicitly setting output.module to false.

Key Changes:

  • Changed default value of output.module from false to true (ES module format is now the default)
  • Updated environment variable logic from RSTEST_OUTPUT_MODULE === 'true' to RSTEST_OUTPUT_MODULE !== 'false' to enable by default
  • Updated all documentation and test files to reflect the new default behavior

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
website/docs/en/config/build/output.mdx Updated English documentation to reflect new default value of true and inverted example code
website/docs/zh/config/build/output.mdx Updated Chinese documentation to reflect new default value of true and inverted example code
packages/core/src/core/rstest.ts Changed environment variable check logic to enable ES modules by default (two occurrences)
e2e/watch/shortcuts.test.ts Updated test fixture path logic to match new default behavior (two occurrences)
e2e/watch/restart.test.ts Updated test fixture path logic to match new default behavior
e2e/watch/index.test.ts Updated test fixture path logic to match new default behavior
e2e/mock/tests/mock.test.ts Updated conditional test logic to match new default behavior
e2e/externals/interop.test.ts Updated test arguments logic to match new default behavior

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

@9aoy 9aoy marked this pull request as draft December 12, 2025 08:44
@github-actions
Copy link

github-actions bot commented Dec 12, 2025

📝 Rstest Ecosystem CI: Open

suite result
rslib ✅ success
rsbuild ✅ success
rsdoctor ✅ success
rspress ✅ success

@9aoy 9aoy changed the title WIP: feat!: output ES module format by default feat: output ES module format by default Dec 26, 2025
@9aoy 9aoy marked this pull request as ready for review January 5, 2026 07:40
@9aoy 9aoy requested a review from fi3ework January 5, 2026 08:27
@9aoy 9aoy merged commit f84cb3d into main Jan 5, 2026
24 of 25 checks passed
@9aoy 9aoy deleted the enable-output-module branch January 5, 2026 09:59
@9aoy 9aoy mentioned this pull request Jan 9, 2026
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