Skip to content

Tests: Group tests that depend on Core assets - #13522

Open
lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:tests/65889-asset-dependent-group
Open

lancewillett wants to merge 1 commit into
WordPress:trunkfrom
lancewillett:tests/65889-asset-dependent-group

Conversation

@lancewillett

@lancewillett lancewillett commented Sep 14, 2026

Copy link
Copy Markdown
Member

Some PHPUnit tests depend on Core JavaScript and CSS files, so they must remain covered when testing is narrowed for frontend-only changes.

Add an assets group to seven existing test methods covering shortcode regex parity, CSS inlining and hoisting, admin view-transition CSS, and generated script-module files. The annotations allow --group assets selection while keeping every test in its normal suite.

The selection includes the methods identified by the empty-assets experiment in Trac comment 4, plus nearby tests that read assets or require them to exist. Emptying a file does not necessarily fail tests whose expectations are derived from that file.

This PR adds test annotations only. Workflow routing is proposed separately in PR #13523, which depends on this group landing first. Bundled-theme metadata, test fixtures, and build tooling still need normal testing; this group does not establish that every .js or .css change can use reduced coverage.

Trac ticket: https://core.trac.wordpress.org/ticket/65889

Testing notes

Validation on current trunk with PHP 8.3.32, MySQL 9.7.2, and PHPUnit 9.6.36:

  • --group assets: 23 tests / 253 assertions passed on both single site and multisite.
  • Generated script-module file check explicitly executed: 1 test / 59 assertions passed.
  • PHPCS passed all five modified files.
  • Assets built with npm run build:dev in Node 24 Docker.

An isolated experiment emptied 1,295 source and generated .js/.css files under src/js/, src/wp-admin/css/, src/wp-admin/js/, src/wp-includes/css/, src/wp-includes/js/, and src/wp-includes/build/ after building. Bundled themes and test fixtures were kept intact.

  • Full single-site run: 26,234 tests; full multisite run: 27,074 tests.
  • Both runs reproduced the same 10 failures covered by this group: shortcode regex parity, eight late-style-hoisting datasets, and admin view-transition CSS.
  • Both also hit Tests_Image_Functions::test_wp_crop_image_with_url. That test still failed alone after restoring assets (error_loading_image: File does not exist? for the remote image), so it was not attributed to asset truncation.
  • All 1,295 assets were restored and verified against their original SHA-256 hashes. The restored assets group passed again: 23 tests / 253 assertions.

The full runs were not green: each reported 11 failures and 86 warnings, with 44 single-site skips and 46 multisite skips. The result supports the group for the tested asset paths; it is not a claim of exhaustive coverage for every frontend file.

Use of AI tools

AI assistance: Yes.
Tool: Codex.
Model: GPT-6.
Used for: Auditing asset-dependent tests, adding group annotations, and local validation.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props lancewillett.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant