Skip to content

test: add coverage for nwjs exports condition#20530

Merged
alexander-akait merged 1 commit intowebpack:mainfrom
aryanraj45:test/target-nwjs
Feb 25, 2026
Merged

test: add coverage for nwjs exports condition#20530
alexander-akait merged 1 commit intowebpack:mainfrom
aryanraj45:test/target-nwjs

Conversation

@aryanraj45
Copy link
Copy Markdown
Contributor

@aryanraj45 aryanraj45 commented Feb 24, 2026

Summary

This PR adds two configCases that had no test coverage:

  1. test/configCases/target/nwjs/ -target: "nwjs" injects the "nwjs" condition into webpack's resolver (via conditions.push("nwjs") in lib/config/defaults.js), but there was no test verifying this condition is actually applied during module resolution. The test requires a package with an exports field containing a "nwjs" condition and asserts the correct file is resolved.

  2. test/configCases/css/webworker/CssModulesPlugin skips emitting a CSS file when chunkLoading is "import-scripts" (webworker target), but CSS module JS exports still work. The test verifies that composes: is correctly resolved and the generated class names are present in the export.

What kind of change does this PR introduce?

test

Did you add tests for your changes?

This PR is the tests. It adds test/configCases/target/nwjs/ and test/configCases/css/webworker/.

Does this PR introduce a breaking change?

No.

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

No documentation needed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 24, 2026

⚠️ No Changeset found

Latest commit: 1538a7a

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

@alexander-akait
Copy link
Copy Markdown
Member

@aryanraj45 Please avoid creations of new PRs for each tests (CI is slow due a lot of PRs and tests), if you want to add many of them just send a PR with the list of added tests or at least group them

@aryanraj45
Copy link
Copy Markdown
Contributor Author

@aryanraj45 Please avoid creations of new PRs for each tests (CI is slow due a lot of PRs and tests), if you want to add many of them just send a PR with the list of added tests or at least group them

okk sure will take care of it to group them from next time onwards
Thanks!

@aryanraj45
Copy link
Copy Markdown
Contributor Author

@alexander-akait grouped the CSS modular test into this exisitng one of nwjs export test as suggested
please take a look thanks !

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 25, 2026

Merging this PR will degrade performance by 36.29%

⚡ 7 improved benchmarks
❌ 1 regressed benchmark
✅ 136 untouched benchmarks

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory benchmark "asset-modules-inline", scenario '{"name":"mode-development","mode":"development"}' 3.6 MB 2.3 MB +55.29%
Memory benchmark "asset-modules-source", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 390.1 KB 227.7 KB +71.33%
Memory benchmark "many-modules-commonjs", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 394.5 KB 276.1 KB +42.91%
Memory benchmark "many-modules-esm", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 802.8 KB 394.2 KB ×2
Memory benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 865.2 KB 645.2 KB +34.09%
Memory benchmark "asset-modules-resource", scenario '{"name":"mode-development","mode":"development"}' 2 MB 3.1 MB -36.29%
Memory benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 6,845.2 KB 395.6 KB ×17
Memory benchmark "asset-modules-source", scenario '{"name":"mode-development","mode":"development"}' 932.1 KB 664.4 KB +40.3%

Comparing aryanraj45:test/target-nwjs (1538a7a) with main (87987ca)

Open in CodSpeed

@aryanraj45
Copy link
Copy Markdown
Contributor Author

@alexander-akait can u please check once CI has been stopped

@alexander-akait
Copy link
Copy Markdown
Member

@aryanraj45 Because we have a lot of PRs and out CI is busy, it will be resolved automatically when we will have free macos runners

@aryanraj45
Copy link
Copy Markdown
Contributor Author

@aryanraj45 Because we have a lot of PRs and out CI is busy, it will be resolved automatically when we will have free macos runners

yeah its been completed as well now u can have a look! thank. you so much

@alexander-akait alexander-akait merged commit f8a5ac3 into webpack:main Feb 25, 2026
54 of 55 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

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

Install it locally:

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

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