Skip to content

Many host-test failures in 'Tests_Block*' tests (missing generated blocks-json.php)? #307

@kmott

Description

@kmott

Describe the bug
I recently noticed quite a few tests are failing in various runners across the board. They mostly seem to look like this:

Tests_Block_Bindings_Post_Meta_Source::test_custom_field_value_is_rendered
The post content should show the value of the custom field . 
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'<p class="wp-block-paragraph">Custom field value</p>'
+'<p>Fallback value</p>'

/var/www/wordpress/tests/phpunit/tests/block-bindings/postMetaSource.php:70

Tests_Block_Bindings_Post_Meta_Source::test_html_attribute_connected_to_custom_field_value_is_rendered
The image src should point to the value of the custom field . 
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'<figure class="wp-block-image"><img decoding="async" src="https://example.com/foo.png" alt=""/></figure>'
+'<figure class="wp-block-image"><img alt=""/></figure>'

/var/www/wordpress/tests/phpunit/tests/block-bindings/postMetaSource.php:95

[ ... ]

For reference, here's various test results from a run this morning:

To Reproduce
Steps to reproduce the behavior:

  1. Go to run a test
  2. Notice it fails

Expected behavior
Tests should pass

Screenshots
N/A

Additional context

After looking at the logs, I see this towards the top (where blocks-json.php is supposed to be generated):

[ ... ]
Running "gutenberg:copy" task
📦 Copying Gutenberg build to build/...
📦 Copying JavaScript packages...
   ✅ vendors/ → vendor/ (react-jsx-runtime only, 2 files)
   ✅ JavaScript packages copied
📦 Copying blocks...
   ✅ block-library blocks copied (121 blocks)
   ✅ widgets blocks copied (2 blocks)
📦 Generating script-modules-packages.php...
   ✅ Generated with 26 modules
📦 Generating script-loader-packages.php...
   ✅ Generated with 66 packages
📦 Generating block registration files...
   ✅ Generated: 81 dynamic, 26 static blocks
📦 Generating blocks-json.php...
   ✅ Generated with 109 blocks
✅ Copy complete!
Running "copy:gutenberg-modules" (copy) task
[ ... ]

But then a little later, it can't seem to find the file for include?

[ ... ]
Tue, 17 Mar 2026 17:07:09 +0000 - INFO - Running WordPress PHPUnit tests ...
Environment variables pass checks.
cd '/var/www/wordpress' && php ./vendor/phpunit/phpunit/phpunit --dont-report-useless-tests
PHP version: 8.5.4 (/usr/local/bin/php)
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHP Warning:  require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
Warning: require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
Warning: require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
PHP Warning:  require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
PHP Warning:  require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
Warning: require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
PHP Warning:  require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
Warning: require(/var/www/wordpress/src/wp-includes/blocks/blocks-json.php): Failed to open stream: No such file or directory in /var/www/wordpress/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php on line 179
[ ... ]

While the test was running, I jumped on the site, and tried to find blocks-json.php (after it was supposedly generated), and it was here:

root@e79b86b12cf8:/var/www# find . -name "blocks-json.php"
./html/wp-includes/blocks/blocks-json.php
./wordpress/build/wp-includes/blocks/blocks-json.php

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions