From b13c1a41442fa69f7cc64da42db6bb3ca4bd1e14 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Wed, 22 Apr 2026 11:16:02 +0530 Subject: [PATCH] Tests: Fix argument forwarding for test:unit workspace scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #77063. After the test/unit workspace conversion, flags passed via `npm run test:unit -- ...` were swallowed by the nested `npm run --workspace` call. For example: npm run test:unit -- --testPathPattern='test/crdt.ts' …ran the entire suite instead of filtering. Append a trailing `--` to each workspace-delegating script so npm forwards all subsequent user args (both flags and positionals) to the workspace command untouched. Also drop the `-- --` workaround in `fixtures:generate` since a single `--` now works end-to-end. --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ca046fbfa0d70f..f7f33c592e0e8e 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "docs:theme-ref": "npm run --workspace tools/api-docs docs:theme-ref", "env": "wp-env", "fixtures:clean": "rimraf --glob \"test/integration/fixtures/blocks/*.{json,serialized.html}\"", - "fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test:unit -- -- test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json", + "fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test:unit -- test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json", "fixtures:regenerate": "npm-run-all fixtures:clean fixtures:generate", "format": "wp-scripts format", "preformat:php": "npm run other:update-packages:php", @@ -197,10 +197,10 @@ "test:performance:debug": "npm exec --workspace @wordpress/performance-tests -- wp-scripts test-playwright --config playwright.config.ts --debug", "test:php": "npm-run-all lint:php test:unit:php", "test:php:watch": "wp-env --config .wp-env.test.json run --env-cwd='wp-content/plugins/gutenberg' cli composer run-script test:watch", - "test:unit": "npm run --workspace @wordpress/unit-tests test:unit", + "test:unit": "npm run --workspace @wordpress/unit-tests test:unit --", "test:unit:date": "bash ./bin/unit-test-date.sh", - "test:unit:debug": "npm run --workspace @wordpress/unit-tests test:unit:debug", - "test:unit:profile": "npm run --workspace @wordpress/unit-tests test:unit:profile", + "test:unit:debug": "npm run --workspace @wordpress/unit-tests test:unit:debug --", + "test:unit:profile": "npm run --workspace @wordpress/unit-tests test:unit:profile --", "test:unit:php:setup": "wp-env --config .wp-env.test.json start", "test:unit:php:setup:debug": "wp-env --config .wp-env.test.json start --xdebug", "test:unit:php:base": "wp-env --config .wp-env.test.json run --env-cwd='wp-content/plugins/gutenberg' wordpress vendor/bin/phpunit -c phpunit.xml.dist --verbose", @@ -210,7 +210,7 @@ "test:unit:php:multisite": "npm-run-all test:unit:php:setup test:unit:php:multisite:base", "test:unit:php:multisite:debug": "npm-run-all test:unit:php:setup:debug test:unit:php:multisite:base", "test:unit:update": "npm run --workspace @wordpress/unit-tests test:unit -- --updateSnapshot", - "test:unit:watch": "npm run --workspace @wordpress/unit-tests test:unit:watch", + "test:unit:watch": "npm run --workspace @wordpress/unit-tests test:unit:watch --", "wp-env": "wp-env", "wp-env-test": "wp-env --config .wp-env.test.json" },