Skip to content

✨ feat(bones): deploy leaves the plugin's test suites out - #136

Merged
gfazioli merged 2 commits into
masterfrom
feat/deploy-skip-tests
Oct 15, 2026
Merged

gfazioli merged 2 commits into
masterfrom
feat/deploy-skip-tests

Conversation

@gfazioli

@gfazioli gfazioli commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

What

php bones deploy now leaves a plugin's test suites out of the package by default:

  • tests/, phpunit.xml, phpunit.xml.dist, phpunit.dist.xml (the PHP suite, where PHPUnit looks for it);
  • jest.config.js, jest.config.json;
  • every __tests__ folder, every *.test.{ts,tsx,js,jsx} / *.spec.{ts,tsx,js,jsx} script, and Jest's __snapshots__ / __mocks__ folders, outside vendor/ and node_modules/ (javascriptTestsToSkip()): the files the jest.config.js written by migrate:to-v2 runs.

And it stops (exit 1, naming them) when the package's Composer autoloader requires a file the package does not hold (assertAutoloadedFilesShipped()), so autoload-dev files in tests/ cannot produce a plugin that is fatal on load.

.phpunit.cache and .phpunit.result.cache needed nothing: the deploy never copies a dot entry. Composer's dev packages were already pruned (2.0.7).

Why

The default skip list named none of these, so a plugin shipped its suites unless its deploy.php listed them. --wp keeps resources/assets, so every __tests__ folder went to WordPress.org with the scripts beside it: Scotty 2.2.0 shipped four, removed by hand before the SVN commit. Scotty and Bannerize now list them in deploy.php; a new plugin with tests should not have to. The entries stay in wpbones_console_deploy_default_skip_files_folders, so a plugin that really ships one can filter it back.

Review

Copilot could not review ("the user who requested the review has reached their quota limit"). An independent clean-context review instead, two rounds:

  1. Found, reproduced: autoload-dev files in tests/ + the dev autoloader kept (--keep-dev, or no dev package to prune) → the package required a missing file on every request (fatal); scandir() warnings on an unreadable folder inside a skipped one; Jest __snapshots__ / __mocks__ still shipped. All three fixed in e81ac85, each with a test that was red first.
  2. Re-ran every reproduction on e81ac85: closed. No false positive from the autoload check with autoload.files in require and require-dev, --keep-dev, prune, --create-zip (no -tmp or .zip left behind), no vendor/, a symlinked path-repo package.
    Left as is, on purpose: the check runs before wpbones_console_deploy_completed, because a completed hook may already ship the package; a deploy.php that rebuilds vendor/ in that hook would be stopped first (none of the local ones does).

Tests

  • tests/Console/DeployTestSuitesTest.php: 6 tests, 27 assertions. On f90f712 (v3.1.0) the first version failed 2 of 4 (out/tests, out/jest.config.js exist); the review round's 3 new checks failed before e81ac85. Three tests guard what must still ship: TestController.php, format.ts beside format.test.ts, latest.ts, vendor/ as Composer installed it, an autoloaded vendor file.
  • composer test: OK, 366 tests, 1020 assertions. CI PHP 8.1–8.4.
  • A copy of Scotty deployed with this bones outside WordPress, so with no deploy.php: --wp --no-build left out tests/, phpunit.xml.dist, jest.config.js and all 4 __tests__ folders, removed the 31 dev packages, and every autoload_files.php entry is present.
  • Live, in WPKirk-Developing (bones-safety-live-smoke.sh, new check: a real deploy --wp --no-build of the bench, whose tracked jest.config.js and resources/assets/apps/__tests__ are joined by a planted tests/, phpunit.xml.dist and probe.test.ts):
    • v3.1.0 (f90f712): ✗ deploy --wp shipped the test suites: jest.config.js phpunit.xml.dist resources/assets/apps/__tests__ resources/assets/apps/probe.test.ts tests, every other check ✓;
    • 060d3ce and e81ac85: 13/13 ✓;
    • wp-content/debug.log unchanged (30 → 30 lines) on both runs.

Docs: wpbones/website-docs#103, to merge with the release.

The default skip list named no tests/, no PHPUnit or Jest configuration and no Jest test, so a plugin shipped its suites unless its deploy.php listed them, and --wp, which keeps resources/assets, shipped every __tests__ folder with the scripts beside it.

The deploy now leaves out tests/, phpunit.xml, phpunit.xml.dist, phpunit.dist.xml, jest.config.js and jest.config.json, and every __tests__ folder and *.test.* / *.spec.* script outside vendor/ and node_modules/, the files the jest.config.js written by migrate:to-v2 runs.
@gfazioli
gfazioli requested a balanced review from Copilot October 15, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

- A Composer "files" entry the deploy left out (autoload-dev naming tests/helpers.php, kept by --keep-dev or by a dev tree with no package to prune) made the package fatal on load: the deploy now stops and names the files.
- Jest's __snapshots__ and __mocks__ folders are left out with the tests beside them.
- A folder that cannot be read is not walked, instead of printing scandir() warnings.
@gfazioli
gfazioli merged commit e81ac85 into master Oct 15, 2026
4 checks passed
@gfazioli
gfazioli deleted the feat/deploy-skip-tests branch October 15, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants