Opened 4 weeks ago
Last modified 2 days ago
#65889 new enhancement
Skip PHPUnit runs on CSS- and JS-only pull requests
| Reported by: | lancewillett | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Build/Test Tools | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
Pull requests that change only CSS or JavaScript still run the full PHPUnit matrix. A recent pull-request run fanned out to 85 jobs, none of which could be affected by that kind of change.
This was raised in #core-build-test-tools on 2026-07-30 by @afercia and drew support from @johnbillion and @westonruter, but no ticket was opened at the time.
Prior art
The Performance Lab repository already does this: its unit tests run only when a PHP-related file changes.
The known obstacle
Some tests in the suite are not really unit tests and do depend on CSS, JS, JSON, or HTML files. One known case asserts whether a particular JS file contains a specific string, guarding against inlining. Those need identifying before any path filter can be trusted, or the filter will silently stop running tests that matter.
Suggested first step
Rather than guessing which tests are PHP-independent, measure it. No-op every .js and .css file on a branch and run the full suite. Whatever fails is the set of tests that genuinely depend on non-PHP assets. Those can be moved into their own group, and the path filter applied to everything else.
That ordering also keeps the risky part reviewable: the filter lands only after the exceptions are known and named, rather than being tuned reactively when something turns out not to run.
Related
- #65887 — publishing per-test timing from CI, which would make the cost of these runs measurable rather than estimated.
Change History (5)
This ticket was mentioned in PR #13075 on WordPress/wordpress-develop by @johnbillion.
4 weeks ago
#1
- Keywords has-patch added
This ticket was mentioned in PR #13088 on WordPress/wordpress-develop by @johnbillion.
4 weeks ago
#2
This is a test PR to identify which PHPUnit tests take into account CSS and JS files.
Trac ticket: Core-65889
This ticket was mentioned in PR #13093 on WordPress/wordpress-develop by @johnbillion.
4 weeks ago
#3
This is a test PR to identify which PHPUnit tests take into account CSS and JS files.
Trac ticket: Core-65889
#4
@
3 weeks ago
Here are the failing tests. See https://github.com/WordPress/wordpress-develop/actions/runs/31984429748/job/95256881182.
There were 10 failures:
1) Tests_Shortcode::test_php_and_js_shortcode_attribute_regexes_match
Failed asserting that 0 is identical to 1.
/var/www/tests/phpunit/tests/shortcode.php:793
/var/www/vendor/bin/phpunit:122
2) Tests_Template::test_wp_hoist_late_printed_styles with data set "standard_classic_theme_config_with_min_styles_inlined" (null, '<!-- wp:separator --><hr clas...st -->', 0, array(array('wp-img-auto-sizes-contain-inline-css', 'early-css', 'early-inline-css', 'wp-emoji-styles-inline-css', 'wp-block-library-css', 'wp-block-separator-css', 'classic-theme-styles-css', 'third-party-test-block-css', 'custom-block-styles-css', 'global-styles-inline-css', 'normal-css', 'normal-inline-css', 'wp-custom-css', 'late-css', 'late-inline-css', 'core-block-supports-inline-css'), array()))
Expected the same styles. Snapshot: array(
'HEAD' => array(
'wp-img-auto-sizes-contain-inline-css',
'early-css',
'early-inline-css',
'wp-emoji-styles-inline-css',
'wp-block-library-css',
'wp-block-separator-css',
'classic-theme-styles-inline-css',
'third-party-test-block-css',
'custom-block-styles-css',
'global-styles-inline-css',
'normal-css',
'normal-inline-css',
'wp-custom-css',
'late-css',
'late-inline-css',
'core-block-supports-inline-css',
),
'BODY' => array(),
)
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
3 => 'wp-emoji-styles-inline-css'
4 => 'wp-block-library-css'
5 => 'wp-block-separator-css'
- 6 => 'classic-theme-styles-css'
+ 6 => 'classic-theme-styles-inline-css'
7 => 'third-party-test-block-css'
8 => 'custom-block-styles-css'
9 => 'global-styles-inline-css'
/var/www/tests/phpunit/tests/template.php:2116
/var/www/vendor/bin/phpunit:122
3) Tests_Template::test_wp_hoist_late_printed_styles with data set "standard_classic_theme_config_extra_block_library_inline_style_none_inlined" (Closure Object (...), '<!-- wp:separator --><hr clas...st -->', 0, array(array('wp-img-auto-sizes-contain-inline-css', 'early-css', 'early-inline-css', 'wp-emoji-styles-inline-css', 'wp-block-library-css', 'wp-block-separator-css', 'wp-block-library-inline-css-extra', 'classic-theme-styles-css', 'third-party-test-block-css', 'custom-block-styles-css', 'global-styles-inline-css', 'normal-css', 'normal-inline-css', 'wp-custom-css', 'late-css', 'late-inline-css', 'core-block-supports-inline-css'), array()), Closure Object (...))
Expected the same styles. Snapshot: array(
'HEAD' => array(
'wp-img-auto-sizes-contain-inline-css',
'early-css',
'early-inline-css',
'wp-emoji-styles-inline-css',
'wp-block-library-css',
'wp-block-separator-css',
'wp-block-library-inline-css-extra',
'classic-theme-styles-inline-css',
'third-party-test-block-css',
'custom-block-styles-css',
--- Expected
+++ Actual
@@ @@
1 => 'early-css'
2 => 'early-inline-css'
3 => 'wp-emoji-styles-inline-css'
- 4 => 'classic-theme-styles-css'
+ 4 => 'classic-theme-styles-inline-css'
5 => 'third-party-test-block-css'
6 => 'custom-block-styles-css'
7 => 'global-styles-inline-css'
/var/www/tests/phpunit/tests/template.php:2116
/var/www/vendor/bin/phpunit:122
9) Tests_Template::test_wp_hoist_late_printed_styles with data set "dequeue_block_library_but_without_theme_json_and_no_block_content" (Closure Object (...), 'Hello World!', 0, array(array('wp-img-auto-sizes-contain-inline-css', 'early-css', 'early-inline-css', 'wp-emoji-styles-inline-css', 'classic-theme-styles-css', 'global-styles-inline-css', 'normal-css', 'normal-inline-css', 'wp-custom-css', 'late-css', 'late-inline-css', 'core-block-supports-inline-css'), array()))
Expected the same styles. Snapshot: array(
'HEAD' => array(
'wp-img-auto-sizes-contain-inline-css',
'early-css',
'early-inline-css',
'wp-emoji-styles-inline-css',
'classic-theme-styles-inline-css',
'global-styles-inline-css',
'normal-css',
'normal-inline-css',
'wp-custom-css',
'late-css',
'late-inline-css',
'core-block-supports-inline-css',
),
'BODY' => array(),
)
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
1 => 'early-css'
2 => 'early-inline-css'
3 => 'wp-emoji-styles-inline-css'
- 4 => 'classic-theme-styles-css'
+ 4 => 'classic-theme-styles-inline-css'
5 => 'global-styles-inline-css'
6 => 'normal-css'
7 => 'normal-inline-css'
/var/www/tests/phpunit/tests/template.php:2116
/var/www/vendor/bin/phpunit:122
10) Tests_View_Transitions_wpEnqueueViewTransitionsAdminCss::test_inline_css_included
Expected `after` data to be an array.
Failed asserting that false is of type "array".
/var/www/tests/phpunit/tests/view-transitions/wpEnqueueViewTransitionsAdminCss.php:49
/var/www/vendor/bin/phpunit:122
#5
@
2 days ago
- Milestone Awaiting Review → 7.2
The spike in comment:4 answered the open question: emptying every .js and .css file breaks 10 tests in three classes, Tests_Shortcode, Tests_Template and Tests_View_Transitions_wpEnqueueViewTransitionsAdminCss. Those are the exceptions a path filter needs.
Two steps, and this is a good ticket for one person to own end to end:
- Add a group to those tests, named for what they depend on.
assetsis one option; happy to bikeshed. - In
phpunit-tests.yml, when the changed paths are only CSS and JavaScript, run a single job with--group <name>instead of the full matrix. The asset-dependent tests still run on every such PR; the other 31,000 do not.
Step 1 is a small test-only PR and can land on its own.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This is a test PR to identify which PHPUnit tests take into account CSS and JS files.
Trac ticket: Core-65889