Repository navigation
✨ feat(bones): deploy leaves the plugin's test suites out - #136
Merged
Merged
Conversation
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.
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
php bones deploynow 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;__tests__folder, every*.test.{ts,tsx,js,jsx}/*.spec.{ts,tsx,js,jsx}script, and Jest's__snapshots__/__mocks__folders, outsidevendor/andnode_modules/(javascriptTestsToSkip()): the files thejest.config.jswritten bymigrate:to-v2runs.And it stops (exit 1, naming them) when the package's Composer autoloader requires a file the package does not hold (
assertAutoloadedFilesShipped()), soautoload-devfilesintests/cannot produce a plugin that is fatal on load..phpunit.cacheand.phpunit.result.cacheneeded 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.phplisted them.--wpkeepsresources/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 indeploy.php; a new plugin with tests should not have to. The entries stay inwpbones_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:
autoload-devfilesintests/+ 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 ine81ac85, each with a test that was red first.e81ac85: closed. No false positive from the autoload check withautoload.filesinrequireandrequire-dev,--keep-dev, prune,--create-zip(no-tmpor.zipleft behind), novendor/, 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; adeploy.phpthat rebuildsvendor/in that hook would be stopped first (none of the local ones does).Tests
tests/Console/DeployTestSuitesTest.php: 6 tests, 27 assertions. Onf90f712(v3.1.0) the first version failed 2 of 4 (out/tests,out/jest.config.jsexist); the review round's 3 new checks failed beforee81ac85. Three tests guard what must still ship:TestController.php,format.tsbesideformat.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.bonesoutside WordPress, so with nodeploy.php:--wp --no-buildleft outtests/,phpunit.xml.dist,jest.config.jsand all 4__tests__folders, removed the 31 dev packages, and everyautoload_files.phpentry is present.bones-safety-live-smoke.sh, new check: a realdeploy --wp --no-buildof the bench, whose trackedjest.config.jsandresources/assets/apps/__tests__are joined by a plantedtests/,phpunit.xml.distandprobe.test.ts):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 ✓;060d3ceande81ac85: 13/13 ✓;wp-content/debug.logunchanged (30 → 30 lines) on both runs.Docs: wpbones/website-docs#103, to merge with the release.