Commit cba0e92e181 for woocommerce
commit cba0e92e181c95e61f03abe29fc37c474fae889c
Author: Vlad Olaru <vlad.olaru@automattic.com>
Date: Fri Sep 18 22:49:19 2026 +0300
[docs] Point the Blocks and admin command docs at scripts that exist (#68838)
* docs(blocks): Point the command docs at scripts that exist
The blocks CLAUDE.md listed four commands the package does not have:
`test:watch` (its script calls a `test` script that was removed),
`test:e2e`, `env:start` and `env:restart`. Blocks kept only `env:stop`
and has no wp-env config of its own, and its e2e specs now run from
the core suite. The plugin README pointed at a `test` script for the
same package, which does not exist either.
Name the commands that work today: `test:js --watch` for watch mode,
and the plugin's `test:e2e:blocks`, `env:dev`, `env:dev:restart` and
`env:start:blocks`. Flags after `test:js` take no `--`, since anything
following `--` reaches jest as a test path pattern.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore(blocks): Remove the dead wp-env:config script
Its only job was to echo "Use env:start instead", and `env:start` does
not exist in this package. Nothing references the script.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore(blocks): Add changelog entry for the stale command cleanup
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs: Point the JS testing and admin command docs at scripts that exist
The Blocks JavaScript testing doc told contributors to run `npm run
test` and listed `test:watch` as the watch-mode command. Neither
exists: `@woocommerce/block-library` has no bare `test` script, so
both fail with "Missing script: test".
The admin section of the plugin README had the same problem, pointing
at `@woocommerce/admin-library` `test` and `test:watch`. That package
defines only `test:js`.
Point all four at scripts that exist, and document the single-file and
watch-mode forms. Every replacement command was run against a local
environment to confirm it works.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore(blocks): Remove the dead test:watch script
`test:watch` was defined as `pnpm run test -- --watch`, but
`@woocommerce/block-library` has no bare `test` script, so running it
fails with ERR_PNPM_NO_SCRIPT. It is the same kind of dead entry as
the `wp-env:config` script removed earlier in this branch, and this
branch removes the last documentation that referenced it.
Jest watch mode remains available through `test:js --watch`, which the
docs now describe.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore(changelog): Cover the testing doc and test:watch removal
Extend the existing entry to mention the JavaScript testing doc, the
admin section of the plugin README, and the removed test:watch script.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* docs: Drop the unnecessary -- from the documented test commands
pnpm 10 passes `--` through to the script verbatim instead of
stripping it, and jest then treats everything after `--` as a
positional test-path pattern. That is why `test:js -- path/to/test`
works while `test:js -- --watch` silently degrades into a path
pattern that matches nothing, and why the watch line needed the
cryptic "(flags take no --)" note to sit next to it.
Verified that `test:js path/to/test` works without the separator, so
drop `--` from the single-file form in both the blocks CLAUDE.md and
the JavaScript testing doc. Both lines now read the same way and the
parenthetical is no longer needed.
Also simplify the changelog comment to the wording suggested in
review.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
diff --git a/plugins/woocommerce/README.md b/plugins/woocommerce/README.md
index 27bb10f8d69..be60f8a9a92 100644
--- a/plugins/woocommerce/README.md
+++ b/plugins/woocommerce/README.md
@@ -57,9 +57,9 @@ pnpm --filter='@woocommerce/plugin-woocommerce' build:admin
# Lint the React-based admin client.
pnpm --filter='@woocommerce/admin-library' lint
# Test the React-based admin client.
-pnpm --filter='@woocommerce/admin-library' test
+pnpm --filter='@woocommerce/admin-library' test:js
# Watch the tests of the React-based admin client.
-pnpm --filter='@woocommerce/admin-library' test:watch
+pnpm --filter='@woocommerce/admin-library' test:js --watch
# Run a type check over the React-based admin client's TypeScript files.
pnpm --filter='@woocommerce/admin-library' ts:check
```
@@ -74,7 +74,7 @@ pnpm --filter='@woocommerce/plugin-woocommerce' build:blocks
# Lint the Blocks client.
pnpm run --filter='@woocommerce/block-library' lint
# Test the Blocks client.
-pnpm run --filter='@woocommerce/block-library' test
+pnpm run --filter='@woocommerce/block-library' test:js
```
## PHP Code Analysis
diff --git a/plugins/woocommerce/client/blocks/CLAUDE.md b/plugins/woocommerce/client/blocks/CLAUDE.md
index 2167dccb778..574c8e1ec44 100644
--- a/plugins/woocommerce/client/blocks/CLAUDE.md
+++ b/plugins/woocommerce/client/blocks/CLAUDE.md
@@ -17,10 +17,10 @@
# Test
pnpm --filter=@woocommerce/block-library test:js # Jest unit tests
-pnpm --filter=@woocommerce/block-library test:js -- path/to/test # Specific test file
-pnpm --filter=@woocommerce/block-library test:watch # Jest watch mode
+pnpm --filter=@woocommerce/block-library test:js path/to/test # Specific test file
+pnpm --filter=@woocommerce/block-library test:js --watch # Jest watch mode
pnpm --filter=@woocommerce/block-library test:update # Update snapshots
-pnpm --filter=@woocommerce/block-library test:e2e # Playwright E2E tests
+pnpm --filter=@woocommerce/plugin-woocommerce test:e2e:blocks # Playwright E2E tests (needs env:start:blocks)
# Lint (target specific files only)
pnpm --filter=@woocommerce/block-library lint:js path/to/file.tsx --fix # Fix JS/TS file (path relative to client/blocks; --fix after the path)
@@ -28,8 +28,9 @@ pnpm --filter=@woocommerce/block-library lint:css # Styleli
pnpm --filter=@woocommerce/block-library ts:check # TypeScript type checking
# Environment
-pnpm --filter=@woocommerce/block-library env:start # Start wp-env + setup
-pnpm --filter=@woocommerce/block-library env:restart # Clean restart
+pnpm --filter=@woocommerce/plugin-woocommerce env:dev # Start wp-env at localhost:8888
+pnpm --filter=@woocommerce/plugin-woocommerce env:dev:restart # Clean restart
+pnpm --filter=@woocommerce/plugin-woocommerce env:start:blocks # Start + seed the E2E env
# Analysis
pnpm --filter=@woocommerce/block-library knip # Find unused code (dead code detector)
diff --git a/plugins/woocommerce/client/blocks/changelog/fix-blocks-docs-stale-commands b/plugins/woocommerce/client/blocks/changelog/fix-blocks-docs-stale-commands
new file mode 100644
index 00000000000..8260e135782
--- /dev/null
+++ b/plugins/woocommerce/client/blocks/changelog/fix-blocks-docs-stale-commands
@@ -0,0 +1,3 @@
+Significance: patch
+Type: dev
+Comment: Update documentation to ensure commands and scripts are up to date.
diff --git a/plugins/woocommerce/client/blocks/docs/contributors/javascript-testing.md b/plugins/woocommerce/client/blocks/docs/contributors/javascript-testing.md
index 7ebd0d5bdc4..e79c49c5f50 100644
--- a/plugins/woocommerce/client/blocks/docs/contributors/javascript-testing.md
+++ b/plugins/woocommerce/client/blocks/docs/contributors/javascript-testing.md
@@ -22,18 +22,19 @@ All the following tests require that the dependencies are installed (`npm instal
Unit tests are implemented near the code they test, in `*.test.js` files.
-Use the following command to run the unit tests:
+Use the following command to run the unit tests, from the monorepo root:
```sh
-npm run test
+pnpm --filter=@woocommerce/block-library test:js
```
The test scripts use [wp-scripts](https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts) to run jest for component and unit testing.
Additionally,
+- `test:js path/to/test` runs a single test file.
+- `test:js --watch` keeps watch of files and automatically re-runs tests when things change.
- `test:update` updates the snapshot tests for components, used if you change a component that has tests attached.
-- `test:watch` keeps watch of files and automatically re-runs tests when things change.
## How to run end-to-end tests
diff --git a/plugins/woocommerce/client/blocks/package.json b/plugins/woocommerce/client/blocks/package.json
index 2b4f3140b77..2b7804c097b 100644
--- a/plugins/woocommerce/client/blocks/package.json
+++ b/plugins/woocommerce/client/blocks/package.json
@@ -80,11 +80,9 @@
"env:stop": "pnpm run wp-env stop",
"test:help": "wp-scripts test-unit-js --help",
"test:update": "wp-scripts test-unit-js --updateSnapshot --config tests/js/jest.config.js",
- "test:watch": "pnpm run test -- --watch",
"ts:check": "tsc --build",
"ts:log-errors": "npm --silent run ts:check | npx -y @bartekbp/typescript-checkstyle > checkstyle.xml",
"wp-env": "wp-env",
- "wp-env:config": "echo 'wp-env:config is no more. Use env:start instead.'",
"watch:build": "pnpm watch:build:project",
"watch:build:project": "pnpm --stream '/^watch:build:project:.*$/'",
"watch:build:project:bundle": "WP_EXPERIMENTAL_MODULES=\"${WP_EXPERIMENTAL_MODULES:-true}\" webpack --watch",