@metamask/snaps-jest 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/README.md +66 -179
- package/dist/cjs/environment.js +21 -82
- package/dist/cjs/environment.js.map +1 -1
- package/dist/cjs/helpers.js +118 -43
- package/dist/cjs/helpers.js.map +1 -1
- package/dist/cjs/internals/environment.js +1 -1
- package/dist/cjs/internals/environment.js.map +1 -1
- package/dist/cjs/internals/index.js +1 -4
- package/dist/cjs/internals/index.js.map +1 -1
- package/dist/cjs/internals/request.js +42 -94
- package/dist/cjs/internals/request.js.map +1 -1
- package/dist/cjs/internals/server.js +0 -4
- package/dist/cjs/internals/server.js.map +1 -1
- package/dist/cjs/internals/simulation/constants.js +29 -0
- package/dist/cjs/internals/simulation/constants.js.map +1 -0
- package/dist/cjs/internals/simulation/controllers.js +95 -0
- package/dist/cjs/internals/simulation/controllers.js.map +1 -0
- package/dist/cjs/internals/simulation/files.js +22 -0
- package/dist/cjs/internals/simulation/files.js.map +1 -0
- package/dist/cjs/internals/simulation/index.js +24 -0
- package/dist/cjs/internals/simulation/index.js.map +1 -0
- package/dist/cjs/internals/simulation/interface.js +98 -0
- package/dist/cjs/internals/simulation/interface.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/constants.js +84 -0
- package/dist/cjs/internals/simulation/methods/constants.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/hooks/encryption.js +33 -0
- package/dist/cjs/internals/simulation/methods/hooks/encryption.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/hooks/get-locale.js +17 -0
- package/dist/cjs/internals/simulation/methods/hooks/get-locale.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/hooks/index.js +25 -0
- package/dist/cjs/internals/simulation/methods/hooks/index.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/hooks/interface.js +26 -0
- package/dist/cjs/internals/simulation/methods/hooks/interface.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/hooks/notifications.js +66 -0
- package/dist/cjs/internals/simulation/methods/hooks/notifications.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/hooks/show-dialog.js +43 -0
- package/dist/cjs/internals/simulation/methods/hooks/show-dialog.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/hooks/state.js +80 -0
- package/dist/cjs/internals/simulation/methods/hooks/state.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/index.js +20 -0
- package/dist/cjs/internals/simulation/methods/index.js.map +1 -0
- package/dist/cjs/internals/simulation/methods/specifications.js +81 -0
- package/dist/cjs/internals/simulation/methods/specifications.js.map +1 -0
- package/dist/cjs/internals/simulation/middleware/engine.js +31 -0
- package/dist/cjs/internals/simulation/middleware/engine.js.map +1 -0
- package/dist/cjs/internals/simulation/middleware/index.js +20 -0
- package/dist/cjs/internals/simulation/middleware/index.js.map +1 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/accounts.js +30 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/accounts.js.map +1 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/index.js +20 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/index.js.map +1 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/middleware.js +37 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/middleware.js.map +1 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/provider-state.js +23 -0
- package/dist/cjs/internals/simulation/middleware/internal-methods/provider-state.js.map +1 -0
- package/dist/cjs/internals/simulation/middleware/mock.js +23 -0
- package/dist/cjs/internals/simulation/middleware/mock.js.map +1 -0
- package/dist/cjs/internals/simulation/options.js +24 -0
- package/dist/cjs/internals/simulation/options.js.map +1 -0
- package/dist/cjs/internals/simulation/simulation.js +124 -0
- package/dist/cjs/internals/simulation/simulation.js.map +1 -0
- package/dist/cjs/internals/simulation/store/index.js +23 -0
- package/dist/cjs/internals/simulation/store/index.js.map +1 -0
- package/dist/cjs/internals/simulation/store/mocks.js +52 -0
- package/dist/cjs/internals/simulation/store/mocks.js.map +1 -0
- package/dist/cjs/internals/simulation/store/notifications.js +52 -0
- package/dist/cjs/internals/simulation/store/notifications.js.map +1 -0
- package/dist/cjs/internals/simulation/store/state.js +64 -0
- package/dist/cjs/internals/simulation/store/state.js.map +1 -0
- package/dist/cjs/internals/simulation/store/store.js +57 -0
- package/dist/cjs/internals/simulation/store/store.js.map +1 -0
- package/dist/cjs/internals/simulation/store/ui.js +48 -0
- package/dist/cjs/internals/simulation/store/ui.js.map +1 -0
- package/dist/cjs/internals/structs.js +47 -5
- package/dist/cjs/internals/structs.js.map +1 -1
- package/dist/cjs/matchers.js +5 -2
- package/dist/cjs/matchers.js.map +1 -1
- package/dist/cjs/options.js +0 -6
- package/dist/cjs/options.js.map +1 -1
- package/dist/esm/environment.js +22 -83
- package/dist/esm/environment.js.map +1 -1
- package/dist/esm/helpers.js +127 -46
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/internals/environment.js +1 -1
- package/dist/esm/internals/environment.js.map +1 -1
- package/dist/esm/internals/index.js +1 -5
- package/dist/esm/internals/index.js.map +1 -1
- package/dist/esm/internals/request.js +61 -104
- package/dist/esm/internals/request.js.map +1 -1
- package/dist/esm/internals/server.js +1 -5
- package/dist/esm/internals/server.js.map +1 -1
- package/dist/esm/internals/simulation/constants.js +12 -0
- package/dist/esm/internals/simulation/constants.js.map +1 -0
- package/dist/esm/internals/simulation/controllers.js +90 -0
- package/dist/esm/internals/simulation/controllers.js.map +1 -0
- package/dist/esm/internals/simulation/files.js +19 -0
- package/dist/esm/internals/simulation/files.js.map +1 -0
- package/dist/esm/internals/simulation/index.js +7 -0
- package/dist/esm/internals/simulation/index.js.map +1 -0
- package/dist/esm/internals/simulation/interface.js +95 -0
- package/dist/esm/internals/simulation/interface.js.map +1 -0
- package/dist/esm/internals/simulation/methods/constants.js +69 -0
- package/dist/esm/internals/simulation/methods/constants.js.map +1 -0
- package/dist/esm/internals/simulation/methods/hooks/encryption.js +39 -0
- package/dist/esm/internals/simulation/methods/hooks/encryption.js.map +1 -0
- package/dist/esm/internals/simulation/methods/hooks/get-locale.js +13 -0
- package/dist/esm/internals/simulation/methods/hooks/get-locale.js.map +1 -0
- package/dist/esm/internals/simulation/methods/hooks/index.js +8 -0
- package/dist/esm/internals/simulation/methods/hooks/index.js.map +1 -0
- package/dist/esm/internals/simulation/methods/hooks/interface.js +18 -0
- package/dist/esm/internals/simulation/methods/hooks/interface.js.map +1 -0
- package/dist/esm/internals/simulation/methods/hooks/notifications.js +58 -0
- package/dist/esm/internals/simulation/methods/hooks/notifications.js.map +1 -0
- package/dist/esm/internals/simulation/methods/hooks/show-dialog.js +38 -0
- package/dist/esm/internals/simulation/methods/hooks/show-dialog.js.map +1 -0
- package/dist/esm/internals/simulation/methods/hooks/state.js +74 -0
- package/dist/esm/internals/simulation/methods/hooks/state.js.map +1 -0
- package/dist/esm/internals/simulation/methods/index.js +3 -0
- package/dist/esm/internals/simulation/methods/index.js.map +1 -0
- package/dist/esm/internals/simulation/methods/specifications.js +84 -0
- package/dist/esm/internals/simulation/methods/specifications.js.map +1 -0
- package/dist/esm/internals/simulation/middleware/engine.js +33 -0
- package/dist/esm/internals/simulation/middleware/engine.js.map +1 -0
- package/dist/esm/internals/simulation/middleware/index.js +3 -0
- package/dist/esm/internals/simulation/middleware/index.js.map +1 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/accounts.js +31 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/accounts.js.map +1 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/index.js +3 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/index.js.map +1 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/middleware.js +37 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/middleware.js.map +1 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/provider-state.js +23 -0
- package/dist/esm/internals/simulation/middleware/internal-methods/provider-state.js.map +1 -0
- package/dist/esm/internals/simulation/middleware/mock.js +18 -0
- package/dist/esm/internals/simulation/middleware/mock.js.map +1 -0
- package/dist/esm/internals/simulation/options.js +20 -0
- package/dist/esm/internals/simulation/options.js.map +1 -0
- package/dist/esm/internals/simulation/simulation.js +128 -0
- package/dist/esm/internals/simulation/simulation.js.map +1 -0
- package/dist/esm/internals/simulation/store/index.js +6 -0
- package/dist/esm/internals/simulation/store/index.js.map +1 -0
- package/dist/esm/internals/simulation/store/mocks.js +32 -0
- package/dist/esm/internals/simulation/store/mocks.js.map +1 -0
- package/dist/esm/internals/simulation/store/notifications.js +30 -0
- package/dist/esm/internals/simulation/store/notifications.js.map +1 -0
- package/dist/esm/internals/simulation/store/state.js +47 -0
- package/dist/esm/internals/simulation/store/state.js.map +1 -0
- package/dist/esm/internals/simulation/store/store.js +50 -0
- package/dist/esm/internals/simulation/store/store.js.map +1 -0
- package/dist/esm/internals/simulation/store/ui.js +21 -0
- package/dist/esm/internals/simulation/store/ui.js.map +1 -0
- package/dist/esm/internals/structs.js +41 -5
- package/dist/esm/internals/structs.js.map +1 -1
- package/dist/esm/matchers.js +5 -2
- package/dist/esm/matchers.js.map +1 -1
- package/dist/esm/options.js +1 -7
- package/dist/esm/options.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/types/environment.d.ts +14 -15
- package/dist/types/helpers.d.ts +64 -3
- package/dist/types/internals/index.d.ts +1 -4
- package/dist/types/internals/request.d.ts +38 -56
- package/dist/types/internals/simulation/constants.d.ts +13 -0
- package/dist/types/internals/simulation/controllers.d.ts +40 -0
- package/dist/types/internals/simulation/files.d.ts +11 -0
- package/dist/types/internals/simulation/index.d.ts +5 -0
- package/dist/types/internals/simulation/interface.d.ts +25 -0
- package/dist/types/internals/simulation/methods/constants.d.ts +10 -0
- package/dist/types/internals/simulation/methods/hooks/encryption.d.ts +29 -0
- package/dist/types/internals/simulation/methods/hooks/get-locale.d.ts +9 -0
- package/dist/types/internals/simulation/methods/hooks/index.d.ts +6 -0
- package/dist/types/internals/simulation/methods/hooks/interface.d.ts +16 -0
- package/dist/types/internals/simulation/methods/hooks/notifications.d.ts +16 -0
- package/dist/types/internals/simulation/methods/hooks/show-dialog.d.ts +9 -0
- package/dist/types/internals/simulation/methods/hooks/state.d.ts +22 -0
- package/dist/types/internals/simulation/methods/index.d.ts +1 -0
- package/dist/types/internals/simulation/methods/specifications.d.ts +56 -0
- package/dist/types/internals/simulation/middleware/engine.d.ts +26 -0
- package/dist/types/internals/simulation/middleware/index.d.ts +1 -0
- package/dist/types/internals/simulation/middleware/internal-methods/accounts.d.ts +18 -0
- package/dist/types/internals/simulation/middleware/internal-methods/index.d.ts +1 -0
- package/dist/types/internals/simulation/middleware/internal-methods/middleware.d.ts +22 -0
- package/dist/types/internals/simulation/middleware/internal-methods/provider-state.d.ts +14 -0
- package/dist/types/internals/simulation/middleware/mock.d.ts +10 -0
- package/dist/types/internals/simulation/options.d.ts +37 -0
- package/dist/types/internals/simulation/simulation.d.ts +98 -0
- package/dist/types/internals/simulation/store/index.d.ts +4 -0
- package/dist/types/internals/simulation/store/mocks.d.ts +35 -0
- package/dist/types/internals/simulation/store/notifications.d.ts +44 -0
- package/dist/types/internals/simulation/store/state.d.ts +55 -0
- package/dist/types/internals/simulation/store/store.d.ts +22 -0
- package/dist/types/internals/simulation/store/ui.d.ts +25 -0
- package/dist/types/internals/structs.d.ts +229 -16
- package/dist/types/options.d.ts +3 -35
- package/dist/types/types.d.ts +88 -41
- package/package.json +21 -12
- package/dist/cjs/internals/interface.js +0 -103
- package/dist/cjs/internals/interface.js.map +0 -1
- package/dist/cjs/internals/network.js +0 -148
- package/dist/cjs/internals/network.js.map +0 -1
- package/dist/cjs/internals/types.js +0 -6
- package/dist/cjs/internals/types.js.map +0 -1
- package/dist/cjs/internals/wait-for.js +0 -63
- package/dist/cjs/internals/wait-for.js.map +0 -1
- package/dist/esm/internals/interface.js +0 -100
- package/dist/esm/internals/interface.js.map +0 -1
- package/dist/esm/internals/network.js +0 -143
- package/dist/esm/internals/network.js.map +0 -1
- package/dist/esm/internals/types.js +0 -3
- package/dist/esm/internals/types.js.map +0 -1
- package/dist/esm/internals/wait-for.js +0 -63
- package/dist/esm/internals/wait-for.js.map +0 -1
- package/dist/types/internals/interface.d.ts +0 -25
- package/dist/types/internals/network.d.ts +0 -87
- package/dist/types/internals/types.d.ts +0 -18
- package/dist/types/internals/wait-for.d.ts +0 -38
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [5.0.0]
|
|
10
|
+
### Added
|
|
11
|
+
- **BREAKING:** Implement testing framework using Node.js executor ([#1982](https://github.com/MetaMask/snaps/pull/1982), [#2118](https://github.com/MetaMask/snaps/pull/2118))
|
|
12
|
+
- The network mocking functionality was removed, but may be reintroduced in a future version.
|
|
13
|
+
- `mockJsonRpc` no longer returns a `Promise`.
|
|
14
|
+
- `runCronjob` was renamed to `onCronjob`, and `sendTransaction` was renamed to `onTransaction`.
|
|
15
|
+
- For backwards compatibility, the old methods are still available, but will be removed in a future version.
|
|
16
|
+
- Add `onHomePage` support ([#2104](https://github.com/MetaMask/snaps/pull/2104))
|
|
17
|
+
- Add `onSignature` support ([#2114](https://github.com/MetaMask/snaps/pull/2114))
|
|
18
|
+
- Add `snap_getClientStatus` support ([#2159](https://github.com/MetaMask/snaps/pull/2159))
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Bump several MetaMask dependencies ([#2101](https://github.com/MetaMask/snaps/pull/2101), [#2100](https://github.com/MetaMask/snaps/pull/2100), [#2129](https://github.com/MetaMask/snaps/pull/2129), [#2140](https://github.com/MetaMask/snaps/pull/2140), [#2141](https://github.com/MetaMask/snaps/pull/2141), [#2142](https://github.com/MetaMask/snaps/pull/2142))
|
|
22
|
+
|
|
23
|
+
## [4.0.1]
|
|
24
|
+
### Fixed
|
|
25
|
+
- Fix coercing of address values in `sendTransaction` function ([#1970](https://github.com/MetaMask/snaps/pull/1970))
|
|
26
|
+
|
|
9
27
|
## [4.0.0]
|
|
10
28
|
### Changed
|
|
11
29
|
- Use `@metamask/snaps-sdk` package ([#1930](https://github.com/MetaMask/snaps/pull/1930),
|
|
@@ -77,7 +95,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
77
95
|
- The version of the package no longer needs to match the version of all other
|
|
78
96
|
MetaMask Snaps packages.
|
|
79
97
|
|
|
80
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@
|
|
98
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@5.0.0...HEAD
|
|
99
|
+
[5.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@4.0.1...@metamask/snaps-jest@5.0.0
|
|
100
|
+
[4.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@4.0.0...@metamask/snaps-jest@4.0.1
|
|
81
101
|
[4.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@3.1.0...@metamask/snaps-jest@4.0.0
|
|
82
102
|
[3.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@3.0.0...@metamask/snaps-jest@3.1.0
|
|
83
103
|
[3.0.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@2.0.0...@metamask/snaps-jest@3.0.0
|
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# `@metamask/snaps-jest`
|
|
2
2
|
|
|
3
3
|
A [Jest](https://jestjs.io/) preset for end-to-end testing MetaMask Snaps,
|
|
4
|
-
including a Jest environment, and a set of Jest matchers.
|
|
5
|
-
currently experimental, and the API may change in the future.
|
|
4
|
+
including a Jest environment, and a set of Jest matchers.
|
|
6
5
|
|
|
7
6
|
- [Installation](#installation)
|
|
8
7
|
- [Usage](#usage)
|
|
@@ -10,11 +9,12 @@ currently experimental, and the API may change in the future.
|
|
|
10
9
|
- [API](#api)
|
|
11
10
|
- [Install a snap](#install-a-snap)
|
|
12
11
|
- [`snap.request`](#snaprequest)
|
|
13
|
-
- [`snap.
|
|
14
|
-
- [`snap.
|
|
12
|
+
- [`snap.onTransaction`](#snapontransaction)
|
|
13
|
+
- [`snap.onSignature`](#snaponsignature)
|
|
14
|
+
- [`snap.onCronjob`](#snaponcronjob)
|
|
15
|
+
- [`snap.onHomePage`](#snaponhomepage)
|
|
15
16
|
- [Jest matchers](#jest-matchers)
|
|
16
17
|
- [Interacting with user interfaces](#interacting-with-user-interfaces)
|
|
17
|
-
- [Network mocking](#network-mocking-snapmock)
|
|
18
18
|
- [Options](#options)
|
|
19
19
|
|
|
20
20
|
## Installation
|
|
@@ -66,8 +66,8 @@ module.exports = {
|
|
|
66
66
|
### Install a snap
|
|
67
67
|
|
|
68
68
|
`@metamask/snaps-jest` exposes a `installSnap` function that can be used to
|
|
69
|
-
install a snap in the
|
|
70
|
-
test, to ensure that each test starts with a clean slate.
|
|
69
|
+
install a snap in the execution environment. It's recommended to use this
|
|
70
|
+
function in each test, to ensure that each test starts with a clean slate.
|
|
71
71
|
|
|
72
72
|
By default, if the built-in server is enabled, it will install the snap from
|
|
73
73
|
the built-in server. Otherwise, you must specify a snap ID to install.
|
|
@@ -174,9 +174,9 @@ describe('MySnap', () => {
|
|
|
174
174
|
});
|
|
175
175
|
```
|
|
176
176
|
|
|
177
|
-
### `snap.
|
|
177
|
+
### `snap.onTransaction`
|
|
178
178
|
|
|
179
|
-
The `
|
|
179
|
+
The `onTransaction` function can be used to send a transaction to the snap. It
|
|
180
180
|
takes a single argument, which is an object with the following properties:
|
|
181
181
|
|
|
182
182
|
- `origin`: The origin of the transaction.
|
|
@@ -204,8 +204,8 @@ import { panel, text } from '@metamask/snaps-sdk';
|
|
|
204
204
|
|
|
205
205
|
describe('MySnap', () => {
|
|
206
206
|
it('should do something', async () => {
|
|
207
|
-
const {
|
|
208
|
-
const response = await
|
|
207
|
+
const { onTransaction } = await installSnap(/* optional snap ID */);
|
|
208
|
+
const response = await onTransaction({
|
|
209
209
|
value: '0x0',
|
|
210
210
|
data: '0x',
|
|
211
211
|
gasLimit: '0x5208',
|
|
@@ -219,9 +219,43 @@ describe('MySnap', () => {
|
|
|
219
219
|
});
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
### `snap.
|
|
222
|
+
### `snap.onSignature`
|
|
223
223
|
|
|
224
|
-
The `
|
|
224
|
+
The `onSignature` function can be used to send a signature request to the snap. It
|
|
225
|
+
takes a single argument, which is an object with the following properties:
|
|
226
|
+
|
|
227
|
+
- `origin`: The origin of the signature request.
|
|
228
|
+
- `from`: The address of the signer.
|
|
229
|
+
- `data`: The data of the signature.
|
|
230
|
+
- `signatureMethod`: The signature method being used in the request.
|
|
231
|
+
|
|
232
|
+
All properties are optional, and have sensible defaults. The addresses are
|
|
233
|
+
randomly generated by default. Most values can be specified as a hex string, or
|
|
234
|
+
a decimal number.
|
|
235
|
+
|
|
236
|
+
It returns an object with the user interface that was shown by the snap, in the
|
|
237
|
+
[onSignature](https://docs.metamask.io/snaps/reference/exports/#onsignature)
|
|
238
|
+
function.
|
|
239
|
+
|
|
240
|
+
```js
|
|
241
|
+
import { installSnap } from '@metamask/snaps-jest';
|
|
242
|
+
import { panel, text } from '@metamask/snaps-sdk';
|
|
243
|
+
|
|
244
|
+
describe('MySnap', () => {
|
|
245
|
+
it('should do something', async () => {
|
|
246
|
+
const { onSignature } = await installSnap(/* optional snap ID */);
|
|
247
|
+
const response = await onSignature();
|
|
248
|
+
|
|
249
|
+
expect(response).toRender(
|
|
250
|
+
panel([text('You are using the personal_sign method')]),
|
|
251
|
+
);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### `snap.onCronjob`
|
|
257
|
+
|
|
258
|
+
The `onCronjob` function can be used to run a cronjob in the snap. It takes
|
|
225
259
|
a single argument, which is similar to a JSON-RPC request object. It returns
|
|
226
260
|
a promise that resolves to the response from the
|
|
227
261
|
[onCronjob](https://docs.metamask.io/snaps/reference/exports/#oncronjob)
|
|
@@ -236,8 +270,8 @@ import { installSnap } from '@metamask/snaps-jest';
|
|
|
236
270
|
|
|
237
271
|
describe('MySnap', () => {
|
|
238
272
|
it('should do something', async () => {
|
|
239
|
-
const {
|
|
240
|
-
const response = await
|
|
273
|
+
const { onCronjob } = await installSnap(/* optional snap ID */);
|
|
274
|
+
const response = await onCronjob({
|
|
241
275
|
method: 'foo',
|
|
242
276
|
params: [],
|
|
243
277
|
});
|
|
@@ -254,8 +288,8 @@ import { installSnap } from '@metamask/snaps-jest';
|
|
|
254
288
|
|
|
255
289
|
describe('MySnap', () => {
|
|
256
290
|
it('should do something', async () => {
|
|
257
|
-
const {
|
|
258
|
-
const response = await
|
|
291
|
+
const { onCronjob } = await installSnap(/* optional snap ID */);
|
|
292
|
+
const response = await onCronjob({
|
|
259
293
|
method: 'foo',
|
|
260
294
|
params: [],
|
|
261
295
|
});
|
|
@@ -266,21 +300,25 @@ describe('MySnap', () => {
|
|
|
266
300
|
});
|
|
267
301
|
```
|
|
268
302
|
|
|
269
|
-
### `snap.
|
|
303
|
+
### `snap.onHomePage`
|
|
270
304
|
|
|
271
|
-
The `
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
305
|
+
The `onHomePage` function can be used to request the home page of the snap. It
|
|
306
|
+
takes no arguments, and returns a promise that resolves to the response from the
|
|
307
|
+
[onHomePage](https://docs.metamask.io/snaps/reference/entry-points/#onhomepage)
|
|
308
|
+
function.
|
|
275
309
|
|
|
276
310
|
```js
|
|
277
311
|
import { installSnap } from '@metamask/snaps-jest';
|
|
278
312
|
|
|
279
313
|
describe('MySnap', () => {
|
|
280
314
|
it('should do something', async () => {
|
|
281
|
-
const {
|
|
282
|
-
|
|
283
|
-
|
|
315
|
+
const { onHomePage } = await installSnap(/* optional snap ID */);
|
|
316
|
+
const response = await onHomePage({
|
|
317
|
+
method: 'foo',
|
|
318
|
+
params: [],
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
expect(response).toRender(/* ... */);
|
|
284
322
|
});
|
|
285
323
|
});
|
|
286
324
|
```
|
|
@@ -300,8 +338,9 @@ assert that a response from a snap matches an expected value:
|
|
|
300
338
|
- `toRender(expectedInterface)`: Check if a snap rendered an interface. This is
|
|
301
339
|
useful for testing the UI of a snap, either for a
|
|
302
340
|
[`snap_dialog`](https://docs.metamask.io/snaps/reference/rpc-api/#snap_dialog),
|
|
303
|
-
|
|
304
|
-
[the transaction insights API](https://docs.metamask.io/snaps/reference/exports/#ontransaction)
|
|
341
|
+
UI rendered by
|
|
342
|
+
[the transaction insights API](https://docs.metamask.io/snaps/reference/exports/#ontransaction) or
|
|
343
|
+
[the signature insights API](https://docs.metamask.io/snaps/reference/exports/#onsignature).
|
|
305
344
|
|
|
306
345
|
### Interacting with user interfaces
|
|
307
346
|
|
|
@@ -345,59 +384,6 @@ describe('MySnap', () => {
|
|
|
345
384
|
});
|
|
346
385
|
```
|
|
347
386
|
|
|
348
|
-
### Network mocking (`snap.mock`)
|
|
349
|
-
|
|
350
|
-
`@metamask/snaps-jest` includes basic network mocking functionality. This can
|
|
351
|
-
be used to mock the response of any network request made by the snap through
|
|
352
|
-
the `endowment:network-access` functionality.
|
|
353
|
-
|
|
354
|
-
The mock function takes a single argument, which is an object with the
|
|
355
|
-
following properties:
|
|
356
|
-
|
|
357
|
-
- `url` (`string | RegExp`): The URL of the request. This can be a string, or a
|
|
358
|
-
regular expression.
|
|
359
|
-
- `partial` (`boolean`): If enabled, the request will be mocked if the URL
|
|
360
|
-
starts with the given URL. This option is ignored if a RegExp is provided to
|
|
361
|
-
the `url` option. Defaults to `false`.
|
|
362
|
-
- `response` (`object`): An object with the response.
|
|
363
|
-
- `status` (`number`): The status code of the response. Defaults to `200`.
|
|
364
|
-
- `body` (`string`): The body of the response. Defaults to an empty string.
|
|
365
|
-
- `headers` (`object`): An object with the headers of the response. By
|
|
366
|
-
default, this will use headers that enable CORS.
|
|
367
|
-
- `contentType` (`string`): The content type of the response. Defaults to
|
|
368
|
-
`text/plain`.
|
|
369
|
-
|
|
370
|
-
Except for the `url` option, all options are optional.
|
|
371
|
-
|
|
372
|
-
#### Unmocking (`mock.unmock`)
|
|
373
|
-
|
|
374
|
-
The mock function returns an object with an `unmock` function that can be
|
|
375
|
-
used to remove the mock. Mocking happens on a per-snap-install basis. If the
|
|
376
|
-
mock is not removed, it will remain active for the rest of the snap
|
|
377
|
-
installation, so it does not affect other tests with a fresh snap installation.
|
|
378
|
-
|
|
379
|
-
#### Example
|
|
380
|
-
|
|
381
|
-
```js
|
|
382
|
-
import { installSnap } from '@metamask/snaps-jest';
|
|
383
|
-
|
|
384
|
-
describe('MySnap', () => {
|
|
385
|
-
it('should do something', async () => {
|
|
386
|
-
const { mock, request } = await installSnap(/* optional snap ID */);
|
|
387
|
-
|
|
388
|
-
const { unmock } = mock({
|
|
389
|
-
url: 'https://example.com',
|
|
390
|
-
status: 200,
|
|
391
|
-
body: 'Hello, world!',
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
// ...
|
|
395
|
-
|
|
396
|
-
unmock();
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
```
|
|
400
|
-
|
|
401
387
|
## Options
|
|
402
388
|
|
|
403
389
|
You can pass options to the test environment by adding a
|
|
@@ -414,44 +400,6 @@ module.exports = {
|
|
|
414
400
|
|
|
415
401
|
All options are optional, and have sensible defaults.
|
|
416
402
|
|
|
417
|
-
### `keepAlive`
|
|
418
|
-
|
|
419
|
-
- Type: `boolean`
|
|
420
|
-
- Default: `false`
|
|
421
|
-
|
|
422
|
-
Whether to keep the Jest environment running after the tests have finished. This
|
|
423
|
-
is useful for debugging, but should not be used in CI environments: When this is
|
|
424
|
-
enabled, the `jest` process will not exit on its own, and will need to be
|
|
425
|
-
manually killed (e.g., with <kbd>Ctrl</kbd> + <kbd>C</kbd>).
|
|
426
|
-
|
|
427
|
-
#### Example
|
|
428
|
-
|
|
429
|
-
```js
|
|
430
|
-
module.exports = {
|
|
431
|
-
preset: '@metamask/snaps-jest',
|
|
432
|
-
testEnvironmentOptions: {
|
|
433
|
-
keepAlive: true,
|
|
434
|
-
},
|
|
435
|
-
};
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
### `browser`
|
|
439
|
-
|
|
440
|
-
- Type: `object`
|
|
441
|
-
|
|
442
|
-
Options for the browser that is used to run the tests.
|
|
443
|
-
|
|
444
|
-
#### `browser.headless`
|
|
445
|
-
|
|
446
|
-
- Type: `boolean`
|
|
447
|
-
- Default: `true`
|
|
448
|
-
|
|
449
|
-
Whether to run the browser in headless mode. By default, it will be enabled. If
|
|
450
|
-
you want to see the browser window while the tests are running, you can disable
|
|
451
|
-
this option. Note that this will require you to have a graphical environment
|
|
452
|
-
available, so it is not recommended for CI environments, but can be useful for
|
|
453
|
-
debugging in conjunction with the `keepAlive` option.
|
|
454
|
-
|
|
455
403
|
### `server`
|
|
456
404
|
|
|
457
405
|
- Type: `object`
|
|
@@ -524,64 +472,3 @@ module.exports = {
|
|
|
524
472
|
},
|
|
525
473
|
};
|
|
526
474
|
```
|
|
527
|
-
|
|
528
|
-
##### Example
|
|
529
|
-
|
|
530
|
-
```js
|
|
531
|
-
module.exports = {
|
|
532
|
-
preset: '@metamask/snaps-jest',
|
|
533
|
-
testEnvironmentOptions: {
|
|
534
|
-
browser: {
|
|
535
|
-
headless: false,
|
|
536
|
-
},
|
|
537
|
-
},
|
|
538
|
-
};
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
### `executionEnvironmentUrl`
|
|
542
|
-
|
|
543
|
-
- Type: `string`
|
|
544
|
-
|
|
545
|
-
The URL of the execution environment to use for testing. This is the URL that
|
|
546
|
-
will be loaded by the Snaps Simulator in the tests. By default, it will use the
|
|
547
|
-
URL of the built-in HTTP server that is included with this package.
|
|
548
|
-
|
|
549
|
-
> **Note**: This option is intended for advanced use cases. In most cases, you
|
|
550
|
-
> should not need to change this option.
|
|
551
|
-
|
|
552
|
-
See also: [`@metamask/snaps-execution-environments`](../snaps-execution-environments/README.md).
|
|
553
|
-
|
|
554
|
-
#### Example
|
|
555
|
-
|
|
556
|
-
```js
|
|
557
|
-
module.exports = {
|
|
558
|
-
preset: '@metamask/snaps-jest',
|
|
559
|
-
testEnvironmentOptions: {
|
|
560
|
-
executionEnvironmentUrl: 'http://localhost:8080',
|
|
561
|
-
},
|
|
562
|
-
};
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
### `simulatorUrl`
|
|
566
|
-
|
|
567
|
-
- Type: `string`
|
|
568
|
-
|
|
569
|
-
The URL of the simulator to use for testing. This is the URL that will be
|
|
570
|
-
loaded in the browser when running tests. By default, it will use the URL of
|
|
571
|
-
the built-in HTTP server that is included with this package.
|
|
572
|
-
|
|
573
|
-
> **Note**: This option is intended for advanced use cases. In most cases, you
|
|
574
|
-
> should not need to change this option.
|
|
575
|
-
|
|
576
|
-
See also: [`@metamask/snaps-simulator`](../snaps-simulator/README.md).
|
|
577
|
-
|
|
578
|
-
#### Example
|
|
579
|
-
|
|
580
|
-
```js
|
|
581
|
-
module.exports = {
|
|
582
|
-
preset: '@metamask/snaps-jest',
|
|
583
|
-
testEnvironmentOptions: {
|
|
584
|
-
simulatorUrl: 'http://localhost:8081',
|
|
585
|
-
},
|
|
586
|
-
};
|
|
587
|
-
```
|
package/dist/cjs/environment.js
CHANGED
|
@@ -18,7 +18,6 @@ _export(exports, {
|
|
|
18
18
|
});
|
|
19
19
|
const _utils = require("@metamask/utils");
|
|
20
20
|
const _jestenvironmentnode = /*#__PURE__*/ _interop_require_default(require("jest-environment-node"));
|
|
21
|
-
const _webdriverio = require("webdriverio");
|
|
22
21
|
const _internals = require("./internals");
|
|
23
22
|
const _options = require("./options");
|
|
24
23
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
@@ -61,26 +60,13 @@ function _class_private_field_set(receiver, privateMap, value) {
|
|
|
61
60
|
_class_apply_descriptor_set(receiver, descriptor, value);
|
|
62
61
|
return value;
|
|
63
62
|
}
|
|
64
|
-
function _define_property(obj, key, value) {
|
|
65
|
-
if (key in obj) {
|
|
66
|
-
Object.defineProperty(obj, key, {
|
|
67
|
-
value: value,
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
obj[key] = value;
|
|
74
|
-
}
|
|
75
|
-
return obj;
|
|
76
|
-
}
|
|
77
63
|
function _interop_require_default(obj) {
|
|
78
64
|
return obj && obj.__esModule ? obj : {
|
|
79
65
|
default: obj
|
|
80
66
|
};
|
|
81
67
|
}
|
|
82
68
|
/* eslint-enable */ const log = (0, _utils.createModuleLogger)(_internals.rootLogger, 'environment');
|
|
83
|
-
var _options1 = /*#__PURE__*/ new WeakMap(), _server = /*#__PURE__*/ new WeakMap();
|
|
69
|
+
var _options1 = /*#__PURE__*/ new WeakMap(), _server = /*#__PURE__*/ new WeakMap(), _instance = /*#__PURE__*/ new WeakMap();
|
|
84
70
|
class SnapsEnvironment extends _jestenvironmentnode.default {
|
|
85
71
|
/**
|
|
86
72
|
* Set up the environment. This starts the built-in HTTP server, and creates a
|
|
@@ -91,48 +77,33 @@ class SnapsEnvironment extends _jestenvironmentnode.default {
|
|
|
91
77
|
log('Starting server.');
|
|
92
78
|
_class_private_field_set(this, _server, await (0, _internals.startServer)(_class_private_field_get(this, _options1).server));
|
|
93
79
|
}
|
|
94
|
-
const args = [];
|
|
95
|
-
if (_class_private_field_get(this, _options1).browser.headless) {
|
|
96
|
-
args.push('--headless', '--disable-gpu');
|
|
97
|
-
}
|
|
98
|
-
log('Starting browser.');
|
|
99
|
-
this.browser = await (0, _webdriverio.remote)({
|
|
100
|
-
logLevel: 'error',
|
|
101
|
-
capabilities: {
|
|
102
|
-
browserName: 'chrome',
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
104
|
-
'goog:chromeOptions': {
|
|
105
|
-
args
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
this.global.browser = this.browser;
|
|
110
80
|
this.global.snapsEnvironment = this;
|
|
111
81
|
}
|
|
112
82
|
/**
|
|
113
83
|
* Tear down the environment. This closes the browser, and stops the built-in
|
|
114
84
|
* HTTP server.
|
|
115
85
|
*/ async teardown() {
|
|
116
|
-
|
|
117
|
-
log('Not tearing down environment because keepAlive is enabled.');
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
log('Closing browser, and stopping server.');
|
|
121
|
-
await this.browser?.deleteSession();
|
|
86
|
+
await _class_private_field_get(this, _instance)?.executionService.terminateAllSnaps();
|
|
122
87
|
_class_private_field_get(this, _server)?.close();
|
|
123
88
|
await super.teardown();
|
|
124
89
|
}
|
|
125
90
|
/**
|
|
126
|
-
*
|
|
91
|
+
* Install a Snap in the environment. This will terminate any previously
|
|
92
|
+
* installed Snaps, and run the Snap code in a new execution service.
|
|
127
93
|
*
|
|
128
|
-
* @
|
|
129
|
-
* @
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
94
|
+
* @param snapId - The ID of the Snap to install.
|
|
95
|
+
* @param options - The options to use when installing the Snap.
|
|
96
|
+
* @param options.executionService - The execution service to use.
|
|
97
|
+
* @param options.executionServiceOptions - The options to use when creating the
|
|
98
|
+
* execution service, if any. This should only include options specific to the
|
|
99
|
+
* provided execution service.
|
|
100
|
+
* @param options.options - The simulation options.
|
|
101
|
+
* @template Service - The type of the execution service.
|
|
102
|
+
* @returns The installed Snap.
|
|
103
|
+
*/ async installSnap(snapId = this.snapId, options = {}) {
|
|
104
|
+
await _class_private_field_get(this, _instance)?.executionService.terminateAllSnaps();
|
|
105
|
+
_class_private_field_set(this, _instance, await (0, _internals.handleInstallSnap)(snapId, options));
|
|
106
|
+
return _class_private_field_get(this, _instance);
|
|
136
107
|
}
|
|
137
108
|
/**
|
|
138
109
|
* Get the snap ID for the current environment, which is used if no snap ID is
|
|
@@ -147,48 +118,12 @@ class SnapsEnvironment extends _jestenvironmentnode.default {
|
|
|
147
118
|
return `local:http://localhost:${port}`;
|
|
148
119
|
}
|
|
149
120
|
/**
|
|
150
|
-
* Create a new page, and attach logging handlers.
|
|
151
|
-
*
|
|
152
|
-
* @param url - The page URL. Defaults to the specified Snaps Simulator URL,
|
|
153
|
-
* or the default simulator URL if none is specified.
|
|
154
|
-
* @param timeout - The page timeout, in milliseconds.
|
|
155
|
-
* @returns The new page.
|
|
156
|
-
*/ async createPage(url = this.url, timeout = 10000) {
|
|
157
|
-
const puppeteer = await this.browser.getPuppeteer();
|
|
158
|
-
const page = await puppeteer.newPage();
|
|
159
|
-
page.setDefaultTimeout(timeout);
|
|
160
|
-
page.setDefaultNavigationTimeout(timeout);
|
|
161
|
-
// Give the page permission to show notifications. This is required for
|
|
162
|
-
// testing `snap_notify`.
|
|
163
|
-
await page.browserContext().overridePermissions(url, [
|
|
164
|
-
'notifications'
|
|
165
|
-
]);
|
|
166
|
-
// `networkidle0` is used to ensure that the page is fully loaded. This
|
|
167
|
-
// makes it wait for no requests to be made, which guarantees that the page
|
|
168
|
-
// is ready.
|
|
169
|
-
await page.goto(url, {
|
|
170
|
-
waitUntil: 'networkidle0'
|
|
171
|
-
});
|
|
172
|
-
const browserLog = (0, _utils.createModuleLogger)(_internals.rootLogger, 'browser');
|
|
173
|
-
page// This is fired when the page calls `console.log` or similar.
|
|
174
|
-
.on('console', (message)=>{
|
|
175
|
-
browserLog(`[${message.type()}] ${message.text()}`);
|
|
176
|
-
})// This is fired when the page throws an error.
|
|
177
|
-
.on('pageerror', ({ message })=>{
|
|
178
|
-
browserLog(`[page error] ${message}`);
|
|
179
|
-
});
|
|
180
|
-
return page;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
121
|
* Constructor.
|
|
184
122
|
*
|
|
185
123
|
* @param options - The environment options.
|
|
186
124
|
* @param context - The environment context.
|
|
187
125
|
*/ constructor(options, context){
|
|
188
126
|
super(options, context);
|
|
189
|
-
// `browser` is always set in the environment setup function. To avoid needing
|
|
190
|
-
// to check for `undefined` everywhere, we use a type assertion here.
|
|
191
|
-
_define_property(this, "browser", void 0);
|
|
192
127
|
_class_private_field_init(this, _options1, {
|
|
193
128
|
writable: true,
|
|
194
129
|
value: void 0
|
|
@@ -197,6 +132,10 @@ class SnapsEnvironment extends _jestenvironmentnode.default {
|
|
|
197
132
|
writable: true,
|
|
198
133
|
value: void 0
|
|
199
134
|
});
|
|
135
|
+
_class_private_field_init(this, _instance, {
|
|
136
|
+
writable: true,
|
|
137
|
+
value: void 0
|
|
138
|
+
});
|
|
200
139
|
_class_private_field_set(this, _options1, (0, _options.getOptions)(options.projectConfig.testEnvironmentOptions));
|
|
201
140
|
}
|
|
202
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/environment.ts"],"sourcesContent":["import type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\nimport { assert, createModuleLogger } from '@metamask/utils';\nimport type { Server } from 'http';\nimport NodeEnvironment from 'jest-environment-node';\nimport type { AddressInfo } from 'net';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../src/environment.ts"],"sourcesContent":["import type {\n EnvironmentContext,\n JestEnvironmentConfig,\n} from '@jest/environment';\nimport type { AbstractExecutionService } from '@metamask/snaps-controllers';\nimport type { SnapId } from '@metamask/snaps-sdk';\nimport { assert, createModuleLogger } from '@metamask/utils';\nimport type { Server } from 'http';\nimport NodeEnvironment from 'jest-environment-node';\nimport type { AddressInfo } from 'net';\n\nimport type { InstalledSnap, InstallSnapOptions } from './internals';\nimport { handleInstallSnap, rootLogger, startServer } from './internals';\nimport type { SnapsEnvironmentOptions } from './options';\nimport { getOptions } from './options';\n\n/* eslint-disable */\ndeclare global {\n const snapsEnvironment: SnapsEnvironment;\n}\n/* eslint-enable */\n\nconst log = createModuleLogger(rootLogger, 'environment');\n\nexport class SnapsEnvironment extends NodeEnvironment {\n #options: SnapsEnvironmentOptions;\n\n #server: Server | undefined;\n\n #instance: InstalledSnap | undefined;\n\n /**\n * Constructor.\n *\n * @param options - The environment options.\n * @param context - The environment context.\n */\n constructor(options: JestEnvironmentConfig, context: EnvironmentContext) {\n super(options, context);\n this.#options = getOptions(options.projectConfig.testEnvironmentOptions);\n }\n\n /**\n * Set up the environment. This starts the built-in HTTP server, and creates a\n * new browser instance.\n */\n async setup() {\n await super.setup();\n\n if (this.#options.server.enabled) {\n log('Starting server.');\n this.#server = await startServer(this.#options.server);\n }\n\n this.global.snapsEnvironment = this;\n }\n\n /**\n * Tear down the environment. This closes the browser, and stops the built-in\n * HTTP server.\n */\n async teardown() {\n await this.#instance?.executionService.terminateAllSnaps();\n this.#server?.close();\n await super.teardown();\n }\n\n /**\n * Install a Snap in the environment. This will terminate any previously\n * installed Snaps, and run the Snap code in a new execution service.\n *\n * @param snapId - The ID of the Snap to install.\n * @param options - The options to use when installing the Snap.\n * @param options.executionService - The execution service to use.\n * @param options.executionServiceOptions - The options to use when creating the\n * execution service, if any. This should only include options specific to the\n * provided execution service.\n * @param options.options - The simulation options.\n * @template Service - The type of the execution service.\n * @returns The installed Snap.\n */\n async installSnap<\n Service extends new (...args: any[]) => InstanceType<\n typeof AbstractExecutionService\n >,\n >(\n snapId: string = this.snapId,\n options: Partial<InstallSnapOptions<Service>> = {},\n ) {\n await this.#instance?.executionService.terminateAllSnaps();\n this.#instance = await handleInstallSnap(snapId as SnapId, options);\n return this.#instance;\n }\n\n /**\n * Get the snap ID for the current environment, which is used if no snap ID is\n * passed to {@link installSnap}. This assumes that the built-in server is\n * running.\n *\n * @returns The snap ID.\n * @throws If the server is not running.\n */\n get snapId() {\n assert(\n this.#server,\n 'You must specify a snap ID, because the built-in server is not running.',\n );\n\n const { port } = this.#server.address() as AddressInfo;\n return `local:http://localhost:${port}`;\n }\n}\n\nexport default SnapsEnvironment;\n"],"names":["SnapsEnvironment","log","createModuleLogger","rootLogger","NodeEnvironment","setup","options","server","enabled","startServer","global","snapsEnvironment","teardown","instance","executionService","terminateAllSnaps","close","installSnap","snapId","handleInstallSnap","assert","port","address","constructor","context","getOptions","projectConfig","testEnvironmentOptions"],"mappings":";;;;;;;;;;;IAwBaA,gBAAgB;eAAhBA;;IAyFb,OAAgC;eAAhC;;;uBA3G2C;4EAEf;2BAI+B;yBAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM3B,iBAAiB,GAEjB,MAAMC,MAAMC,IAAAA,yBAAkB,EAACC,qBAAU,EAAE;IAGzC,yCAEA,uCAEA;AALK,MAAMH,yBAAyBI,4BAAe;IAkBnD;;;GAGC,GACD,MAAMC,QAAQ;QACZ,MAAM,KAAK,CAACA;QAEZ,IAAI,yBAAA,IAAI,EAAEC,WAAQC,MAAM,CAACC,OAAO,EAAE;YAChCP,IAAI;2CACEM,SAAS,MAAME,IAAAA,sBAAW,EAAC,yBAAA,IAAI,EAAEH,WAAQC,MAAM;QACvD;QAEA,IAAI,CAACG,MAAM,CAACC,gBAAgB,GAAG,IAAI;IACrC;IAEA;;;GAGC,GACD,MAAMC,WAAW;QACf,+BAAM,IAAI,EAAEC,YAAUC,iBAAiBC;iCACvC,IAAI,EAAER,UAAQS;QACd,MAAM,KAAK,CAACJ;IACd;IAEA;;;;;;;;;;;;;GAaC,GACD,MAAMK,YAKJC,SAAiB,IAAI,CAACA,MAAM,EAC5BZ,UAAgD,CAAC,CAAC,EAClD;QACA,+BAAM,IAAI,EAAEO,YAAUC,iBAAiBC;uCACjCF,WAAW,MAAMM,IAAAA,4BAAiB,EAACD,QAAkBZ;QAC3D,gCAAO,IAAI,EAAEO;IACf;IAEA;;;;;;;GAOC,GACD,IAAIK,SAAS;QACXE,IAAAA,aAAM,2BACJ,IAAI,EAAEb,UACN;QAGF,MAAM,EAAEc,IAAI,EAAE,GAAG,yBAAA,IAAI,EAAEd,SAAOe,OAAO;QACrC,OAAO,CAAC,uBAAuB,EAAED,KAAK,CAAC;IACzC;IA/EA;;;;;GAKC,GACDE,YAAYjB,OAA8B,EAAEkB,OAA2B,CAAE;QACvE,KAAK,CAAClB,SAASkB;QAbjB,gCAAA;;mBAAA,KAAA;;QAEA,gCAAA;;mBAAA,KAAA;;QAEA,gCAAA;;mBAAA,KAAA;;uCAUQlB,WAAUmB,IAAAA,mBAAU,EAACnB,QAAQoB,aAAa,CAACC,sBAAsB;IACzE;AAuEF;MAEA,WAAe3B"}
|