PHPUnit
Jetpack comes with a suite of PHPUnit tests.
Writing unit tests is highly
For the Jetpack plugin, you can run the tests through the Jetpack CLI:
jetpack docker phpunit
The above command will also accept any regular PHPUnit arguments passed to it. For example:
jetpack docker phpunit -- --filter=Protect
It’s also possible to simulate a multi-site install when running the tests by running
jetpack docker phpunit-multisite
JavaScript
Jetpack also includes several Jest based unit tests for our JavaScript code. These test suites can be executed using the following commands:
pnpm test-client
pnpm test-gui
pnpm test-modules
It’s possible to further narrow down the test run to only the tests matching a specific patten by using the -g
or --grep
pattern arguments. For example:
pnpm test-gui -g 'my custom pattern'
To use a custom reporter, use the -R
or --reporter
argument:
pnpm test-client -R 'my_reporter'
E2E Tests
We have an E2E test suites for WordPress.com Simple and Atomic, which live inside the Calypso repository.