Testing is an integral part of creating new features and maintaining the software.
A few actions are automatically run via Github Actions when a pull request is created or updated.
We run the following checks:
- linting
- format checking
- type checks
We use the dependaban action from Automattic/vip-actions to verify that no dependencies have install scripts.
Unit tests in __tests__ are run. They are powered by Jest and report any failures, along with test coverage.
Tests should be written for any major features or security sensitive functionality, as a minimum. Writing tests for new or updated utility functions is recommended.
E2E test are run. They can be found at __tests__/devenv-e2e.
We run the above unit and E2E tests on Windows as well.
CodeQL analysis is started automatically.
Install and set up the environment, and then run:
npm run test
To test against a local instance of the WPVIP API, you can use the API_HOST
environment variable. Unset the VIP_PROXY
variable as well.
Examples:
VIP_PROXY="" API_HOST=http://localhost:4000 node ./dist/bin/vip
VIP_PROXY="" API_HOST=http://localhost:4000 node ./dist/bin/vip app
VIP_PROXY="" API_HOST=http://localhost:4000 node ./dist/bin/vip -- wp option get home
TODO: How should final testing before releasing be done?