Skip to content

Latest commit

 

History

History
67 lines (37 loc) · 2.51 KB

TESTING.md

File metadata and controls

67 lines (37 loc) · 2.51 KB

Testing

Testing is an integral part of creating new features and maintaining the software.

Automated testing

A few actions are automatically run via Github Actions when a pull request is created or updated.

Linting

We run the following checks:

  • linting
  • format checking
  • type checks

Dependency checks

We use the dependaban action from Automattic/vip-actions to verify that no dependencies have install scripts.

Unit tests

Unit tests in __tests__ are run. They are powered by Jest and report any failures, along with test coverage.

Adding new unit tests

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 tests

E2E test are run. They can be found at __tests__/devenv-e2e.

Windows tests

We run the above unit and E2E tests on Windows as well.

CodeQL analysis

CodeQL analysis is started automatically.

Manual testing

Running unit tests locally

Install and set up the environment, and then run:

npm run test

Local testing

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

Final testing before releasing

TODO: How should final testing before releasing be done?