-
Notifications
You must be signed in to change notification settings - Fork 0
User runCLI and unit tests to test plugins and themes #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Run Asyncify and JSPI modes simultaneously instead of sequentially - Smart port allocation: Asyncify uses workerId, JSPI uses workerId + MAX_CONCURRENCY - Reduces test time per item from ~4min to ~2min (~50% improvement) - Configurable via single MAX_CONCURRENCY constant (default: 8) - Supports MAX_CONCURRENCY × 2 concurrent Playground instances - No port conflicts, scales automatically with concurrency setting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the testing infrastructure to use Vitest and @wp-playground/cli for comprehensive integration tests of WordPress plugins and themes. Previously only basic boot tests were supported; now the system can validate WordPress boot, post creation, wp-admin loading, and plugin/theme activation.
Key Changes:
- Introduced Vitest-based test framework with
wordpress.spec.tsintegration tests - Implemented dual-mode testing (Asyncify and JSPI) that runs in parallel for each item
- Added error log parser to extract and categorize PHP, SQL, and Playground runtime errors
Reviewed Changes
Copilot reviewed 8 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Configures Vitest with 2-minute timeouts and exclusion patterns |
| src/test/unit/wordpress.spec.ts | Core integration tests for WordPress boot, post creation, wp-admin, and plugin/theme activation |
| src/test-runner.ts | Spawns Vitest with mode-specific Node.js flags (JSPI vs Asyncify) |
| src/test-batch.ts | Orchestrates batch testing with concurrency control and aggregates results from both modes |
| src/lib/log-parser.ts | Parses error logs and test results to generate structured error reports |
| package.json | Updates dependencies to support new testing framework |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The wordpress-develop directory was registered as a submodule in Git's index but not in .gitmodules, causing CI failures when trying to initialize submodules. This directory is not used by the playground compatibility tester and is excluded from tests. Fixes CI error: fatal: No url found for submodule path 'wordpress-develop' in .gitmodules 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation for the change, related issues
The previous testing infrastructure only supported basic boot tests. This refactor introduces Vitest as the test framework, enabling us to write comprehensive integration tests for WordPress plugins and themes.
Implementation details
Test Framework:
@wp-playground/clisrc/test/unit/wordpress.spec.ts- validates boot, post creation, wp-admin loading, plugin/theme activationvitest.config.tswith 2-minute timeouts for WordPress installationsrc/test-runner.tsspawns vitest with mode-specific Node.js flags--experimental-wasm-jspiflagError Parser (
src/lib/log-parser.ts):Testing instructions
Run unit tests:
npm testTest single item:
Test a batch:
Expected output:
TODO