Skip to content

test(target): add config case coverage for electron-main and electron-preload#20630

Merged
alexander-akait merged 1 commit intowebpack:mainfrom
junaiddshaukat:test/add-electron-target-config-cases
Mar 11, 2026
Merged

test(target): add config case coverage for electron-main and electron-preload#20630
alexander-akait merged 1 commit intowebpack:mainfrom
junaiddshaukat:test/add-electron-target-config-cases

Conversation

@junaiddshaukat
Copy link
Copy Markdown
Contributor

Summary

This PR adds config case coverage for the missing Electron target contexts:

  • electron-main
  • electron-preload
    webpack already has a config case for electron-renderer under test/configCases/target/electron-renderer, but there was no dedicated config case coverage for the other two supported Electron target contexts.
    The new test cases use a small local fixture package with both main and browser fields and assert that:
  • electron-renderer prefers the browser field (existing behavior)
  • electron-main prefers the main field
  • electron-preload prefers the main field
    This helps verify the target-specific resolution behavior and improves regression coverage around Electron target handling.

Fixes: #20629

What kind of change does this PR introduce?

test

Did you add tests for your changes?

Yes

Added two new config case test folders:

  • test/configCases/target/electron-main
  • test/configCases/target/electron-preload

I also ran targeted local verification for these config cases. The new electron cases compiled successfully.

Does this PR introduce a breaking change?

No.
This only adds test coverage.

If relevant, what needs to be documented once your changes are merged or what have you already documented?

No additional documentation is needed because this PR only adds tests.

Use of AI

I used AI for planning and drafting some text. I reviewed the repo structure, issue scope, test setup, and final code changes manually before preparing this PR.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 11, 2026

⚠️ No Changeset found

Latest commit: cca8229

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 11, 2026

Merging this PR will degrade performance by 25.82%

⚡ 3 improved benchmarks
❌ 2 regressed benchmarks
✅ 139 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory benchmark "lodash", scenario '{"name":"mode-development","mode":"development"}' 5.3 MB 4.1 MB +28.42%
Memory benchmark "asset-modules-source", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 620.7 KB 264.8 KB ×2.3
Memory benchmark "devtool-eval-source-map", scenario '{"name":"mode-production","mode":"production"}' 6.3 MB 7.8 MB -20.14%
Memory benchmark "many-modules-commonjs", scenario '{"name":"mode-production","mode":"production"}' 7.4 MB 10 MB -25.82%
Memory benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 863.8 KB 644.6 KB +34.01%

Comparing junaiddshaukat:test/add-electron-target-config-cases (cca8229) with main (7e786cb)

Open in CodSpeed

@alexander-akait alexander-akait merged commit d5fc9c6 into webpack:main Mar 11, 2026
54 of 55 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (d5fc9c6).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@d5fc9c6
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@d5fc9c6
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@d5fc9c6

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.

test(target): add config case coverage for electron-main and electron-preload targets

2 participants