Jest 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 Jest for a package, see jest.config.js within that package.
- Run
yarn workspace <workspaceName> run testto run all tests for a package. - Run
yarn workspace <workspaceName> run jest --no-coverage <file>to run a test file within the context of a package. - Run
yarn testto run tests for all packages.
Note
workspaceNamein these commands is thenamefield within a package'spackage.json, e.g.,@metamask/address-book-controller, not the directory where it is located, e.g.,packages/address-book-controller.