Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

Addresses feedback on #74827 regarding unsafe use of delete operator on built-in global objects in test code.

Built-in globals like WebAssembly and SharedArrayBuffer are typically non-configurable. Using delete on them in strict mode (which Jest enforces) can throw TypeError depending on engine implementation details.

Changes

  • Replace delete global.WebAssembly with global.WebAssembly = undefined
  • Replace delete global.SharedArrayBuffer with global.SharedArrayBuffer = undefined
  • Update comments to reflect "setting to undefined" rather than "removing"
-  // @ts-ignore - Intentionally removing WebAssembly for testing.
-  delete global.WebAssembly;
+  // @ts-ignore - Intentionally setting WebAssembly to undefined for testing.
+  global.WebAssembly = undefined;

This achieves the same test behavior (simulating unavailable features) while avoiding potential engine-specific failures.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • translate.wordpress.org
    • Triggering command: /usr/local/bin/node node i18n-cache/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update WebAssembly support detection and fallbacks Replace delete with undefined assignment for global objects in tests Jan 27, 2026
Copilot AI requested a review from adamsilverstein January 27, 2026 21:13
@github-actions
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

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