Skip to content

Latest commit

 

History

History
16 lines (11 loc) · 1.02 KB

testing.md

File metadata and controls

16 lines (11 loc) · 1.02 KB

Writing and running tests

Vitest is used to ensure that code is working as expected. Ideally, all packages should have 100% test coverage.

Please follow the MetaMask unit testing guidelines when writing tests.

If you need to customize the behavior of the test runner for a package, see vitest.config.ts within that package.

  • Run yarn workspace <workspaceName> run test to run all tests for a package.
  • Run yarn workspace <workspaceName> run test run <file> --coverage.enabled=false to run a single test file.
  • Run yarn test to run tests for all packages.
  • Run yarn test:packages --project <directory-name> from the root to run a single package through the root Vitest projects config.

Note

workspaceName in these commands is the name field within a package's package.json, e.g., @metamask/address-book-controller, not the directory where it is located, e.g., packages/address-book-controller.