core
core copied to clipboard
This monorepo is a collection of packages used across multiple MetaMask clients
Somewhat related to #493. Some tests have expect calls in event handlers that aren't guaranteed to be executed during the test. If the code under test changes such that the...
* Keeping the setup for each unit test in the individual test makes it easier to understand what behaviour it is testing. A test should be readable in isolation, without...
This makes it possible to run Jest with `--detectOpenHandles`, which will make it possible to [ensure all async operations are completed before tests end](#493).
Currently we are not setting [`resetMocks: true`](https://jestjs.io/docs/configuration#resetmocks-boolean) and [`restoreMocks: true`](https://jestjs.io/docs/configuration#restoremocks-boolean) within `jest.config.js`. We should enable this and remove calls to `jest.clearAllMocks()` and `jest.resetAllMocks()` within test files. Note that this may...
Jest provides a built-in means of stubbing modules, and it works just as well as Sinon. There really should be no reason to use Sinon (aside from perhaps stubbing timers).
Jest uses Istanbul under the hood to scan for and report on test coverage. At any point we can instruct Istanbul to exclude a section of code for consideration in...
Test coverage for this file is so low that changes are liable to go past the threshold we've set. At the moment we've disabled coverage checks for this file so...
`revokePermissions`, `revokeAllPermissions`, and related methods / actions of the `PermissionController` throw if the user is trying to revoke a permission that does not exist (which is either because a particular...
Allows lazier consumption of the resulting API: permissions could be requested as-needed. Maybe added as an option? As discussed in https://github.com/MetaMask/metamask-extension/issues/6110
We should add a `require` parameter to permissions requests to allow domains to require specific permissions. These permissions cannot be deselected in the UI, and the entire request will fail...