vscode-phpunit
Monorepo for the PHPUnit & Pest Test Explorer VS Code extension.

Packages
| Package |
Description |
packages/phpunit |
@vscode-phpunit/phpunit — PHPUnit/Pest parser, runner, and tree-sitter utilities. Built with tsup (ESM + CJS). |
packages/extension |
VS Code extension — Test Explorer integration for PHPUnit & Pest. Bundled with esbuild. Depends on @vscode-phpunit/phpunit. |
packages/phpunit
Core library that parses PHPUnit/Pest test files (via tree-sitter WASM, with php-parser as the fallback), builds command lines, and processes test output. It knows nothing about VS Code: the extension composes it into the Test Explorer. Published as @vscode-phpunit/phpunit.
- Build:
tsup outputs ESM/CJS to dist/, and copies tree-sitter.wasm / tree-sitter-php.wasm into dist/.
- Test: Vitest
packages/extension
VS Code extension that integrates with the native Test Explorer UI. Consumes @vscode-phpunit/phpunit as a dev dependency; esbuild bundles everything into a single dist/extension.js.
- Build:
esbuild bundles to dist/extension.js, and copies WASM files from node_modules/@vscode/tree-sitter-wasm/wasm/ to dist/.
- Test: Vitest — unit tests, and acceptance tests that run real PHPUnit/Pest against a fake
vscode (src/extension.*.test.ts) — plus @vscode/test-cli e2e tests in real VS Code (tests/)
- Package:
@vscode/vsce produces .vsix
Development
Prerequisites
Setup
pnpm install
Common Commands
# Compile all packages (phpunit tsup + extension esbuild)
pnpm compile
# Run all unit tests
pnpm test
# Run e2e tests (extension only)
pnpm test:e2e
# Lint
pnpm lint
# Type check
pnpm typecheck
# Production build for extension (minified)
pnpm package
# Produce .vsix file
cd packages/extension && pnpm exec vsce package --no-dependencies
Debugging the Extension
The repository includes launch configurations in .vscode/launch.json:
| Configuration |
Description |
| Run Extension |
Opens with a local phpunit-stub project |
| Run Extension (Multi-Workspace) |
Opens a multi-folder workspace (local) |
| Run Extension (Docker Multi-Workspace) |
Opens a multi-folder workspace running inside Docker |
Docker Multi-Workspace Setup
-
Start the shared container:
cd packages/phpunit/tests/fixtures/workspaces
docker compose up -d --build
-
Select Run Extension (Docker Multi-Workspace) from the debug panel and press F5.
-
Stop the container:
docker compose down
Contributing
License
MIT
评论