Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

Migrate all test cases to ES modules:

  • update package.json files to use "type": "module"
  • convert .mjs files to .js
  • replace __dirname with import.meta.dirname

Checklist

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

Copilot AI review requested due to automatic review settings November 7, 2025 13:29
@netlify
Copy link

netlify bot commented Nov 7, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit c211e93
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/690df434ee6cc00008b391c9
😎 Deploy Preview https://deploy-preview-6531--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 56 (🔴 down 1 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

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 pull request migrates the e2e test suite from CommonJS to ES modules (ESM). The migration involves:

  • Adding "type": "module" to package.json files throughout the e2e directory
  • Replacing __dirname with import.meta.dirname (Node.js 20.11+ feature)
  • Adding .ts extensions to relative imports in TypeScript files
  • Converting CommonJS exports (module.exports) to ESM exports (export)
  • Changing file extensions from .mjs to .js for ES module files
  • Removing manual __dirname polyfills using fileURLToPath
  • Enabling TypeScript compiler option allowImportingTsExtensions

Reviewed Changes

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

Show a summary per file
File Description
e2e/package.json, e2e/helper/package.json, e2e/cases/*/package.json Added "type": "module" to enable ESM
e2e/tsconfig.json Added allowImportingTsExtensions compiler option
e2e/helper/*.ts Updated imports to include .ts extensions
e2e/cases/**/*.test.ts Replaced __dirname with import.meta.dirname
e2e/cases/**/rsbuild.config.ts Replaced __dirname with import.meta.dirname
e2e/cases/**/*.js Converted from CommonJS to ESM, changed .mjs to .js
e2e/test.cjs New test file using CommonJS (likely for testing interop)
e2e/cases/module/esm-exports/* Removed test files (test no longer relevant)
Comments suppressed due to low confidence (1)

e2e/cases/plugin-babel/basic/plugins/myBabelPlugin.ts:4

  • [nitpick] The type annotation added to the path parameter is overly simplified and may not accurately represent the Babel NodePath type. Consider importing the proper type from @babel/traverse or @babel/core for better type safety and IDE support, e.g., import type { NodePath } from '@babel/traverse' and then use Identifier(path: NodePath<t.Identifier>).

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

@chenjiahan chenjiahan merged commit fd9d012 into main Nov 8, 2025
18 checks passed
@chenjiahan chenjiahan deleted the e2e_esm_1107 branch November 8, 2025 03:11
@chenjiahan chenjiahan mentioned this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants