Skip to content

Conversation

LingyuCoder
Copy link
Contributor

Summary

Remove runner factories and move logic to the test cases


This pull request refactors the test runner infrastructure in rspack-test-tools to simplify and modernize how test runners are created and managed. The main change is the removal of multiple runner factory classes in favor of a more flexible runner creator interface, which streamlines runner instantiation and improves maintainability. Several related APIs and type definitions are updated to support this new approach. Additionally, new runner types and utilities are introduced to support web-based and multi-compiler test scenarios.

Test Runner Infrastructure Refactor

  • Removed legacy runner factory classes (BasicRunnerFactory, CacheRunnerFactory, HotRunnerFactory, MultipleRunnerFactory, WatchRunnerFactory) from the public API and replaced them with the TTestRunnerCreator interface for a more flexible runner creation mechanism. [1] [2] [3]

  • Updated the test context API: replaced getRunnerFactory and setRunner methods with a single getRunner method that directly creates and returns a runner instance, simplifying runner management. [1] [2] [3] [4]

  • Changed configuration options (runner, runnerFactory) in IBasicCaseCreatorOptions and ITesterConfig to use the new TTestRunnerCreator type, ensuring consistent runner creation throughout the codebase. [1] [2]

New Runner Types and Utilities

  • Added the WebRunner class and IWebRunnerOptions interface to support running tests in a web (DOM) environment, and integrated these into cache test scenarios. [1] [2] [3] [4]

  • Added utilities for multi-compiler runner management (createMultiCompilerRunner, getMultiCompilerRunnerKey) and updated config test cases to use these new utilities. [1] [2]

Test Case Migration

  • Migrated individual test case files (cache.ts, config.ts, hot-step.ts, hook.ts) to use the new runner creator interface, replacing direct references to runner factory classes with the new pattern. [1] [2] [3] [4]

Type and API Cleanup

  • Removed unused types related to hot module replacement runtime data (THotStepRuntimeData, THotStepRuntimeLangData) and updated imports accordingly. [1] [2] [3]

[1] [2] [3] [4] [5]

Related links

Checklist

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

@Copilot Copilot AI review requested due to automatic review settings September 23, 2025 10:30
Copy link

netlify bot commented Sep 23, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 054e58b
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68d277439f7a910008b927b1

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Sep 23, 2025
Copy link
Contributor

@Copilot 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 refactors the test runner infrastructure in rspack-test-tools to remove legacy runner factory classes and replace them with a more flexible runner creator interface. The main goal is to modernize and simplify test runner instantiation and management.

  • Replaces multiple runner factory classes with a unified TTestRunnerCreator interface
  • Consolidates runner creation logic directly into test case files
  • Introduces new web runner types and utilities for enhanced test scenarios

Reviewed Changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/rspack-test-tools/src/type.ts Removes legacy runner factory imports, adds TTestRunnerCreator interface and moves runner-related types from deleted files
packages/rspack-test-tools/src/test/creator.ts Updates runner configuration to use new TTestRunnerCreator type instead of factory classes
packages/rspack-test-tools/src/test/context.ts Replaces getRunnerFactory/setRunner methods with unified getRunner method that creates runners directly
packages/rspack-test-tools/src/runner/ Removes multiple factory files and consolidates exports to just node and web runners
packages/rspack-test-tools/src/case/ Migrates all test case files to use new runner creator pattern with inline runner creation functions
packages/rspack-test-tools/etc/test-tools.api.md Updates public API to reflect removal of factory classes and addition of new runner types

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

Copy link
Contributor

📦 Binary Size-limit

Comparing 054e58b to test: remove processor (#11738) by harpsealjs

🙈 Size remains the same at 47.43MB

Copy link

codspeed-hq bot commented Sep 23, 2025

CodSpeed Performance Report

Merging #11741 will not alter performance

Comparing test/remove-runner-factory (054e58b) with main (4548937)

Summary

✅ 17 untouched

@hardfist hardfist merged commit 9509e5d into main Sep 23, 2025
68 of 70 checks passed
@hardfist hardfist deleted the test/remove-runner-factory branch September 23, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants