镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 1023 Bytes

testing.md

File metadata and controls

15 lines (10 loc) · 1023 Bytes

Writing and running tests

Jest and Vitest are 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 jest.config.cjs or vitest.config.js within that package.

  • Run yarn workspace <workspaceName> run test to run all tests for a package.
  • Run yarn workspace <workspaceName> run jest --no-coverage <file> (Jest) or yarn workspace <workspaceName> run vitest run <file> (Vitest) to run a single test file.
  • Run yarn test to run tests for all packages.

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.