Skip to content

test: add coverage for external script in EnvironmentNotSupportAsyncW…#20525

Merged
alexander-akait merged 1 commit intowebpack:mainfrom
aryanraj45:test/environment-not-support-async-warning-script-external
Feb 25, 2026
Merged

test: add coverage for external script in EnvironmentNotSupportAsyncW…#20525
alexander-akait merged 1 commit intowebpack:mainfrom
aryanraj45:test/environment-not-support-async-warning-script-external

Conversation

@aryanraj45
Copy link
Copy Markdown
Contributor

Summary

EnvironmentNotSupportAsyncWarning has 6 code paths that emit the warning (one per Feature type), but the existing integration test in async-module/environment-not-support-async-warning only covered 5 of them — "external script" was missing.

This PR adds coverage for the "external script" code path by:

  • Adding "external-script" to the externals config (script scriptGlobal@https://example.com/script.js)
  • Re-exporting it from reexport.js
  • Setting globalThis.scriptGlobal before the dynamic import in index.js (needed because script externals resolve via a global variable in Node.js)
  • Adding the corresponding warning matcher in warnings.js

All 6 Feature variants are now covered in a single test:
topLevelAwait, external import, external module, external promise, external script, asyncWebAssembly

What kind of change does this PR introduce?

test

Did you add tests for your changes?

This PR is the test itself.

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: 510abf0

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 Feb 24, 2026

Merging this PR will degrade performance by 23.04%

⚡ 3 improved benchmarks
❌ 1 regressed benchmark
✅ 140 untouched benchmarks

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory benchmark "context-esm", scenario '{"name":"mode-production","mode":"production"}' 9.8 MB 7.2 MB +37.25%
Memory benchmark "many-chunks-esm", scenario '{"name":"mode-production","mode":"production"}' 7.8 MB 10.1 MB -23.04%
Memory benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 865.2 KB 645 KB +34.14%
Memory benchmark "many-modules-esm", scenario '{"name":"mode-production","mode":"production"}' 11.1 MB 9.1 MB +22.26%

Comparing aryanraj45:test/environment-not-support-async-warning-script-external (510abf0) with main (87987ca)

Open in CodSpeed

@aryanraj45
Copy link
Copy Markdown
Contributor Author

@alexander-akait can u please take a look ! I will group my next two open PR test nwjs test and CSS moduler as one and and create them as a single PR

@alexander-akait
Copy link
Copy Markdown
Member

globalThis is not supported by Node@10, you filter this test for Node@10 using supports helper

@aryanraj45 aryanraj45 force-pushed the test/environment-not-support-async-warning-script-external branch from d8c611d to 510abf0 Compare February 24, 2026 14:19
@aryanraj45
Copy link
Copy Markdown
Contributor Author

@alexander-akait can u please take a look ! I will group my next two open PR test nwjs test and CSS moduler as one and and create them as a single PR

globalThis is not supported by Node@10, you filter this test for Node@10 using supports helper

Updated added supportsGlobalThis to test.filter.js so the test is skipped on Node@10.

@aryanraj45
Copy link
Copy Markdown
Contributor Author

@alexander-akait can u please have a look thanks

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

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

Install it locally:

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

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