@metamask/snaps-jest 8.3.0 → 8.3.1
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 +11 -2
- package/dist/environment.cjs +96 -0
- package/dist/environment.cjs.map +1 -0
- package/dist/{types/environment.d.ts → environment.d.cts} +5 -4
- package/dist/environment.d.cts.map +1 -0
- package/dist/environment.d.mts +53 -0
- package/dist/environment.d.mts.map +1 -0
- package/dist/environment.mjs +94 -44
- package/dist/environment.mjs.map +1 -1
- package/dist/global.cjs +4 -0
- package/dist/global.cjs.map +1 -0
- package/dist/{types/global.d.ts → global.d.cts} +2 -1
- package/dist/global.d.cts.map +1 -0
- package/dist/global.d.mts +70 -0
- package/dist/global.d.mts.map +1 -0
- package/dist/global.mjs +2 -1
- package/dist/global.mjs.map +1 -1
- package/dist/helpers.cjs +240 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/{types/helpers.d.ts → helpers.d.cts} +5 -4
- package/dist/helpers.d.cts.map +1 -0
- package/dist/helpers.d.mts +132 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +228 -56
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -67
- package/dist/index.mjs.map +1 -1
- package/dist/internals/environment.cjs +18 -0
- package/dist/internals/environment.cjs.map +1 -0
- package/dist/{types/internals/environment.d.ts → internals/environment.d.cts} +1 -0
- package/dist/internals/environment.d.cts.map +1 -0
- package/dist/internals/environment.d.mts +8 -0
- package/dist/internals/environment.d.mts.map +1 -0
- package/dist/internals/environment.mjs +13 -7
- package/dist/internals/environment.mjs.map +1 -1
- package/dist/internals/index.cjs +23 -0
- package/dist/internals/index.cjs.map +1 -0
- package/dist/internals/index.d.cts +7 -0
- package/dist/internals/index.d.cts.map +1 -0
- package/dist/internals/index.d.mts +7 -0
- package/dist/internals/index.d.mts.map +1 -0
- package/dist/internals/index.mjs +6 -149
- package/dist/internals/index.mjs.map +1 -1
- package/dist/internals/logger.cjs +6 -0
- package/dist/internals/logger.cjs.map +1 -0
- package/dist/{types/internals/logger.d.ts → internals/logger.d.cts} +1 -0
- package/dist/internals/logger.d.cts.map +1 -0
- package/dist/internals/logger.d.mts +3 -0
- package/dist/internals/logger.d.mts.map +1 -0
- package/dist/internals/logger.mjs +2 -7
- package/dist/internals/logger.mjs.map +1 -1
- package/dist/internals/request.cjs +143 -0
- package/dist/internals/request.cjs.map +1 -0
- package/dist/{types/internals/request.d.ts → internals/request.d.cts} +7 -6
- package/dist/internals/request.d.cts.map +1 -0
- package/dist/internals/request.d.mts +56 -0
- package/dist/internals/request.d.mts.map +1 -0
- package/dist/internals/request.mjs +137 -41
- package/dist/internals/request.mjs.map +1 -1
- package/dist/internals/server.cjs +74 -0
- package/dist/internals/server.cjs.map +1 -0
- package/dist/{types/internals/server.d.ts → internals/server.d.cts} +3 -2
- package/dist/internals/server.d.cts.map +1 -0
- package/dist/internals/server.d.mts +15 -0
- package/dist/internals/server.d.mts.map +1 -0
- package/dist/internals/server.mjs +73 -8
- package/dist/internals/server.mjs.map +1 -1
- package/dist/internals/simulation/constants.cjs +21 -0
- package/dist/internals/simulation/constants.cjs.map +1 -0
- package/dist/{types/internals/simulation/constants.d.ts → internals/simulation/constants.d.cts} +1 -0
- package/dist/internals/simulation/constants.d.cts.map +1 -0
- package/dist/internals/simulation/constants.d.mts +18 -0
- package/dist/internals/simulation/constants.d.mts.map +1 -0
- package/dist/internals/simulation/constants.mjs +17 -13
- package/dist/internals/simulation/constants.mjs.map +1 -1
- package/dist/internals/simulation/controllers.cjs +101 -0
- package/dist/internals/simulation/controllers.cjs.map +1 -0
- package/dist/{types/internals/simulation/controllers.d.ts → internals/simulation/controllers.d.cts} +11 -10
- package/dist/internals/simulation/controllers.d.cts.map +1 -0
- package/dist/internals/simulation/controllers.d.mts +41 -0
- package/dist/internals/simulation/controllers.d.mts.map +1 -0
- package/dist/internals/simulation/controllers.mjs +95 -24
- package/dist/internals/simulation/controllers.mjs.map +1 -1
- package/dist/internals/simulation/files.cjs +94 -0
- package/dist/internals/simulation/files.cjs.map +1 -0
- package/dist/{types/internals/simulation/files.d.ts → internals/simulation/files.d.cts} +6 -4
- package/dist/internals/simulation/files.d.cts.map +1 -0
- package/dist/internals/simulation/files.d.mts +49 -0
- package/dist/internals/simulation/files.d.mts.map +1 -0
- package/dist/internals/simulation/files.mjs +90 -13
- package/dist/internals/simulation/files.mjs.map +1 -1
- package/dist/internals/simulation/index.cjs +22 -0
- package/dist/internals/simulation/index.cjs.map +1 -0
- package/dist/internals/simulation/index.d.cts +6 -0
- package/dist/internals/simulation/index.d.cts.map +1 -0
- package/dist/internals/simulation/index.d.mts +6 -0
- package/dist/internals/simulation/index.d.mts.map +1 -0
- package/dist/internals/simulation/index.mjs +5 -110
- package/dist/internals/simulation/index.mjs.map +1 -1
- package/dist/internals/simulation/interface.cjs +527 -0
- package/dist/internals/simulation/interface.cjs.map +1 -0
- package/dist/{types/internals/simulation/interface.d.ts → internals/simulation/interface.d.cts} +9 -8
- package/dist/internals/simulation/interface.d.cts.map +1 -0
- package/dist/internals/simulation/interface.d.mts +152 -0
- package/dist/internals/simulation/interface.d.mts.map +1 -0
- package/dist/internals/simulation/interface.mjs +512 -36
- package/dist/internals/simulation/interface.mjs.map +1 -1
- package/dist/internals/simulation/methods/constants.cjs +72 -0
- package/dist/internals/simulation/methods/constants.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/constants.d.ts → internals/simulation/methods/constants.d.cts} +1 -0
- package/dist/internals/simulation/methods/constants.d.cts.map +1 -0
- package/dist/internals/simulation/methods/constants.d.mts +11 -0
- package/dist/internals/simulation/methods/constants.d.mts.map +1 -0
- package/dist/internals/simulation/methods/constants.mjs +68 -11
- package/dist/internals/simulation/methods/constants.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.cjs +18 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/get-preferences.d.ts → internals/simulation/methods/hooks/get-preferences.d.cts} +2 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.d.mts +14 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/get-preferences.mjs +13 -7
- package/dist/internals/simulation/methods/hooks/get-preferences.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/index.cjs +22 -0
- package/dist/internals/simulation/methods/hooks/index.cjs.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.d.cts +6 -0
- package/dist/internals/simulation/methods/hooks/index.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.d.mts +6 -0
- package/dist/internals/simulation/methods/hooks/index.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/index.mjs +5 -38
- package/dist/internals/simulation/methods/hooks/index.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/interface.cjs +24 -0
- package/dist/internals/simulation/methods/hooks/interface.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/interface.d.ts → internals/simulation/methods/hooks/interface.d.cts} +3 -2
- package/dist/internals/simulation/methods/hooks/interface.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/interface.d.mts +17 -0
- package/dist/internals/simulation/methods/hooks/interface.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/interface.mjs +18 -9
- package/dist/internals/simulation/methods/hooks/interface.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/notifications.cjs +58 -0
- package/dist/internals/simulation/methods/hooks/notifications.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/notifications.d.ts → internals/simulation/methods/hooks/notifications.d.cts} +5 -4
- package/dist/internals/simulation/methods/hooks/notifications.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/notifications.d.mts +17 -0
- package/dist/internals/simulation/methods/hooks/notifications.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/notifications.mjs +54 -15
- package/dist/internals/simulation/methods/hooks/notifications.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.cjs +38 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/request-user-approval.d.ts → internals/simulation/methods/hooks/request-user-approval.d.cts} +2 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts +16 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/request-user-approval.mjs +34 -13
- package/dist/internals/simulation/methods/hooks/request-user-approval.mjs.map +1 -1
- package/dist/internals/simulation/methods/hooks/state.cjs +84 -0
- package/dist/internals/simulation/methods/hooks/state.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/hooks/state.d.ts → internals/simulation/methods/hooks/state.d.cts} +3 -2
- package/dist/internals/simulation/methods/hooks/state.d.cts.map +1 -0
- package/dist/internals/simulation/methods/hooks/state.d.mts +24 -0
- package/dist/internals/simulation/methods/hooks/state.d.mts.map +1 -0
- package/dist/internals/simulation/methods/hooks/state.mjs +78 -17
- package/dist/internals/simulation/methods/hooks/state.mjs.map +1 -1
- package/dist/internals/simulation/methods/index.cjs +18 -0
- package/dist/internals/simulation/methods/index.cjs.map +1 -0
- package/dist/internals/simulation/methods/index.d.cts +2 -0
- package/dist/internals/simulation/methods/index.d.cts.map +1 -0
- package/dist/internals/simulation/methods/index.d.mts +2 -0
- package/dist/internals/simulation/methods/index.d.mts.map +1 -0
- package/dist/internals/simulation/methods/index.mjs +1 -27
- package/dist/internals/simulation/methods/index.mjs.map +1 -1
- package/dist/internals/simulation/methods/specifications.cjs +85 -0
- package/dist/internals/simulation/methods/specifications.cjs.map +1 -0
- package/dist/{types/internals/simulation/methods/specifications.d.ts → internals/simulation/methods/specifications.d.cts} +6 -5
- package/dist/internals/simulation/methods/specifications.d.cts.map +1 -0
- package/dist/internals/simulation/methods/specifications.d.mts +57 -0
- package/dist/internals/simulation/methods/specifications.d.mts.map +1 -0
- package/dist/internals/simulation/methods/specifications.mjs +77 -26
- package/dist/internals/simulation/methods/specifications.mjs.map +1 -1
- package/dist/internals/simulation/middleware/engine.cjs +37 -0
- package/dist/internals/simulation/middleware/engine.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/engine.d.ts → internals/simulation/middleware/engine.d.cts} +7 -6
- package/dist/internals/simulation/middleware/engine.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/engine.d.mts +27 -0
- package/dist/internals/simulation/middleware/engine.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/engine.mjs +33 -14
- package/dist/internals/simulation/middleware/engine.mjs.map +1 -1
- package/dist/internals/simulation/middleware/index.cjs +18 -0
- package/dist/internals/simulation/middleware/index.cjs.map +1 -0
- package/dist/internals/simulation/middleware/index.d.cts +2 -0
- package/dist/internals/simulation/middleware/index.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/index.d.mts +2 -0
- package/dist/internals/simulation/middleware/index.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/index.mjs +1 -15
- package/dist/internals/simulation/middleware/index.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.cjs +34 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/internal-methods/accounts.d.ts → internals/simulation/middleware/internal-methods/accounts.d.cts} +4 -2
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts +20 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs +29 -7
- package/dist/internals/simulation/middleware/internal-methods/accounts.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/index.cjs +18 -0
- package/dist/internals/simulation/middleware/internal-methods/index.cjs.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.cts +2 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.mts +2 -0
- package/dist/internals/simulation/middleware/internal-methods/index.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/index.mjs +1 -10
- package/dist/internals/simulation/middleware/internal-methods/index.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.cjs +44 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/internal-methods/middleware.d.ts → internals/simulation/middleware/internal-methods/middleware.d.cts} +3 -2
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts +23 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs +38 -8
- package/dist/internals/simulation/middleware/internal-methods/middleware.mjs.map +1 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs +28 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/internal-methods/provider-state.d.ts → internals/simulation/middleware/internal-methods/provider-state.d.cts} +4 -2
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts +16 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs +23 -7
- package/dist/internals/simulation/middleware/internal-methods/provider-state.mjs.map +1 -1
- package/dist/internals/simulation/middleware/mock.cjs +22 -0
- package/dist/internals/simulation/middleware/mock.cjs.map +1 -0
- package/dist/{types/internals/simulation/middleware/mock.d.ts → internals/simulation/middleware/mock.d.cts} +4 -3
- package/dist/internals/simulation/middleware/mock.d.cts.map +1 -0
- package/dist/internals/simulation/middleware/mock.d.mts +11 -0
- package/dist/internals/simulation/middleware/mock.d.mts.map +1 -0
- package/dist/internals/simulation/middleware/mock.mjs +17 -8
- package/dist/internals/simulation/middleware/mock.mjs.map +1 -1
- package/dist/internals/simulation/options.cjs +25 -0
- package/dist/internals/simulation/options.cjs.map +1 -0
- package/dist/{types/internals/simulation/options.d.ts → internals/simulation/options.d.cts} +3 -2
- package/dist/internals/simulation/options.d.cts.map +1 -0
- package/dist/internals/simulation/options.d.mts +40 -0
- package/dist/internals/simulation/options.d.mts.map +1 -0
- package/dist/internals/simulation/options.mjs +20 -8
- package/dist/internals/simulation/options.mjs.map +1 -1
- package/dist/internals/simulation/simulation.cjs +155 -0
- package/dist/internals/simulation/simulation.cjs.map +1 -0
- package/dist/{types/internals/simulation/simulation.d.ts → internals/simulation/simulation.d.cts} +11 -9
- package/dist/internals/simulation/simulation.d.cts.map +1 -0
- package/dist/internals/simulation/simulation.d.mts +103 -0
- package/dist/internals/simulation/simulation.d.mts.map +1 -0
- package/dist/internals/simulation/simulation.mjs +149 -38
- package/dist/internals/simulation/simulation.mjs.map +1 -1
- package/dist/internals/simulation/store/index.cjs +21 -0
- package/dist/internals/simulation/store/index.cjs.map +1 -0
- package/dist/internals/simulation/store/index.d.cts +5 -0
- package/dist/internals/simulation/store/index.d.cts.map +1 -0
- package/dist/internals/simulation/store/index.d.mts +5 -0
- package/dist/internals/simulation/store/index.d.mts.map +1 -0
- package/dist/internals/simulation/store/index.mjs +4 -43
- package/dist/internals/simulation/store/index.mjs.map +1 -1
- package/dist/internals/simulation/store/mocks.cjs +39 -0
- package/dist/internals/simulation/store/mocks.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/mocks.d.ts → internals/simulation/store/mocks.d.cts} +6 -5
- package/dist/internals/simulation/store/mocks.d.cts.map +1 -0
- package/dist/internals/simulation/store/mocks.d.mts +36 -0
- package/dist/internals/simulation/store/mocks.d.mts.map +1 -0
- package/dist/internals/simulation/store/mocks.mjs +33 -14
- package/dist/internals/simulation/store/mocks.mjs.map +1 -1
- package/dist/internals/simulation/store/notifications.cjs +35 -0
- package/dist/internals/simulation/store/notifications.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/notifications.d.ts → internals/simulation/store/notifications.d.cts} +6 -5
- package/dist/internals/simulation/store/notifications.d.cts.map +1 -0
- package/dist/internals/simulation/store/notifications.d.mts +45 -0
- package/dist/internals/simulation/store/notifications.d.mts.map +1 -0
- package/dist/internals/simulation/store/notifications.mjs +30 -14
- package/dist/internals/simulation/store/notifications.mjs.map +1 -1
- package/dist/internals/simulation/store/state.cjs +54 -0
- package/dist/internals/simulation/store/state.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/state.d.ts → internals/simulation/store/state.d.cts} +6 -5
- package/dist/internals/simulation/store/state.d.cts.map +1 -0
- package/dist/internals/simulation/store/state.d.mts +56 -0
- package/dist/internals/simulation/store/state.d.mts.map +1 -0
- package/dist/internals/simulation/store/state.mjs +48 -12
- package/dist/internals/simulation/store/state.mjs.map +1 -1
- package/dist/internals/simulation/store/store.cjs +51 -0
- package/dist/internals/simulation/store/store.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/store.d.ts → internals/simulation/store/store.d.cts} +2 -1
- package/dist/internals/simulation/store/store.d.cts.map +1 -0
- package/dist/internals/simulation/store/store.d.mts +22 -0
- package/dist/internals/simulation/store/store.d.mts.map +1 -0
- package/dist/internals/simulation/store/store.mjs +44 -11
- package/dist/internals/simulation/store/store.mjs.map +1 -1
- package/dist/internals/simulation/store/ui.cjs +24 -0
- package/dist/internals/simulation/store/ui.cjs.map +1 -0
- package/dist/{types/internals/simulation/store/ui.d.ts → internals/simulation/store/ui.d.cts} +6 -5
- package/dist/internals/simulation/store/ui.d.cts.map +1 -0
- package/dist/internals/simulation/store/ui.d.mts +27 -0
- package/dist/internals/simulation/store/ui.d.mts.map +1 -0
- package/dist/internals/simulation/store/ui.mjs +19 -14
- package/dist/internals/simulation/store/ui.mjs.map +1 -1
- package/dist/internals/structs.cjs +157 -0
- package/dist/internals/structs.cjs.map +1 -0
- package/dist/{types/internals/structs.d.ts → internals/structs.d.cts} +28 -27
- package/dist/internals/structs.d.cts.map +1 -0
- package/dist/internals/structs.d.mts +205 -0
- package/dist/internals/structs.d.mts.map +1 -0
- package/dist/internals/structs.mjs +153 -21
- package/dist/internals/structs.mjs.map +1 -1
- package/dist/matchers.cjs +160 -0
- package/dist/matchers.cjs.map +1 -0
- package/dist/{types/matchers.d.ts → matchers.d.cts} +4 -3
- package/dist/matchers.d.cts.map +1 -0
- package/dist/matchers.d.mts +28 -0
- package/dist/matchers.d.mts.map +1 -0
- package/dist/matchers.mjs +152 -47
- package/dist/matchers.mjs.map +1 -1
- package/dist/options.cjs +24 -0
- package/dist/options.cjs.map +1 -0
- package/dist/{types/options.d.ts → options.d.cts} +2 -1
- package/dist/options.d.cts.map +1 -0
- package/dist/options.d.mts +61 -0
- package/dist/options.d.mts.map +1 -0
- package/dist/options.mjs +19 -7
- package/dist/options.mjs.map +1 -1
- package/dist/setup.cjs +7 -0
- package/dist/setup.cjs.map +1 -0
- package/dist/setup.d.cts +2 -0
- package/dist/setup.d.cts.map +1 -0
- package/dist/setup.d.mts +2 -0
- package/dist/setup.d.mts.map +1 -0
- package/dist/setup.mjs +4 -37
- package/dist/setup.mjs.map +1 -1
- package/dist/types/index.cjs +18 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.mts.map +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/types.cjs +3 -0
- package/dist/types/types.cjs.map +1 -0
- package/dist/types/{types.d.ts → types.d.cts} +7 -6
- package/dist/types/types.d.cts.map +1 -0
- package/dist/types/types.d.mts +386 -0
- package/dist/types/types.d.mts.map +1 -0
- package/dist/types/types.mjs +2 -0
- package/dist/types/types.mjs.map +1 -0
- package/jest-preset.js +1 -1
- package/package.json +25 -23
- package/dist/chunk-24CGIQLL.mjs +0 -30
- package/dist/chunk-24CGIQLL.mjs.map +0 -1
- package/dist/chunk-2JTGBHPR.js +0 -14
- package/dist/chunk-2JTGBHPR.js.map +0 -1
- package/dist/chunk-2RJYSYUB.js +0 -28
- package/dist/chunk-2RJYSYUB.js.map +0 -1
- package/dist/chunk-2YE2P5BZ.js +0 -36
- package/dist/chunk-2YE2P5BZ.js.map +0 -1
- package/dist/chunk-3FNLFVV2.js +0 -15
- package/dist/chunk-3FNLFVV2.js.map +0 -1
- package/dist/chunk-3J2IBWXV.mjs +0 -39
- package/dist/chunk-3J2IBWXV.mjs.map +0 -1
- package/dist/chunk-3NP6BDGK.js +0 -167
- package/dist/chunk-3NP6BDGK.js.map +0 -1
- package/dist/chunk-55J6XMHW.js +0 -1
- package/dist/chunk-55J6XMHW.js.map +0 -1
- package/dist/chunk-57SGDM5B.mjs +0 -69
- package/dist/chunk-57SGDM5B.mjs.map +0 -1
- package/dist/chunk-5U5WB3SM.mjs +0 -41
- package/dist/chunk-5U5WB3SM.mjs.map +0 -1
- package/dist/chunk-5ZFHFICZ.mjs +0 -1
- package/dist/chunk-5ZFHFICZ.mjs.map +0 -1
- package/dist/chunk-6HHV6YFQ.mjs +0 -1
- package/dist/chunk-6HHV6YFQ.mjs.map +0 -1
- package/dist/chunk-6JPBXAHM.mjs +0 -509
- package/dist/chunk-6JPBXAHM.mjs.map +0 -1
- package/dist/chunk-6V6MFT67.js +0 -38
- package/dist/chunk-6V6MFT67.js.map +0 -1
- package/dist/chunk-7PCHIR6O.mjs +0 -181
- package/dist/chunk-7PCHIR6O.mjs.map +0 -1
- package/dist/chunk-ALRZENWP.mjs +0 -42
- package/dist/chunk-ALRZENWP.mjs.map +0 -1
- package/dist/chunk-AMAL4SJH.js +0 -153
- package/dist/chunk-AMAL4SJH.js.map +0 -1
- package/dist/chunk-C26TYXXD.mjs +0 -240
- package/dist/chunk-C26TYXXD.mjs.map +0 -1
- package/dist/chunk-CACRY3TX.mjs +0 -104
- package/dist/chunk-CACRY3TX.mjs.map +0 -1
- package/dist/chunk-CKRORVDW.js +0 -1
- package/dist/chunk-CKRORVDW.js.map +0 -1
- package/dist/chunk-D653LBAY.js +0 -34
- package/dist/chunk-D653LBAY.js.map +0 -1
- package/dist/chunk-DR6Y7IVX.js +0 -1
- package/dist/chunk-DR6Y7IVX.js.map +0 -1
- package/dist/chunk-DUVKGPX5.js +0 -509
- package/dist/chunk-DUVKGPX5.js.map +0 -1
- package/dist/chunk-EMTW3H54.js +0 -20
- package/dist/chunk-EMTW3H54.js.map +0 -1
- package/dist/chunk-FP4H3ADT.mjs +0 -20
- package/dist/chunk-FP4H3ADT.mjs.map +0 -1
- package/dist/chunk-FQWOVTBB.mjs +0 -22
- package/dist/chunk-FQWOVTBB.mjs.map +0 -1
- package/dist/chunk-G333FBBL.mjs +0 -38
- package/dist/chunk-G333FBBL.mjs.map +0 -1
- package/dist/chunk-GECE47HW.js +0 -1
- package/dist/chunk-GECE47HW.js.map +0 -1
- package/dist/chunk-GLPGOEVE.js +0 -240
- package/dist/chunk-GLPGOEVE.js.map +0 -1
- package/dist/chunk-GMTKFAWO.js +0 -42
- package/dist/chunk-GMTKFAWO.js.map +0 -1
- package/dist/chunk-H2464AXT.mjs +0 -33
- package/dist/chunk-H2464AXT.mjs.map +0 -1
- package/dist/chunk-HROOL3VI.js +0 -1
- package/dist/chunk-HROOL3VI.js.map +0 -1
- package/dist/chunk-IWJ4HKDR.mjs +0 -50
- package/dist/chunk-IWJ4HKDR.mjs.map +0 -1
- package/dist/chunk-IXKO6X55.mjs +0 -15
- package/dist/chunk-IXKO6X55.mjs.map +0 -1
- package/dist/chunk-J3I5KZIF.js +0 -22
- package/dist/chunk-J3I5KZIF.js.map +0 -1
- package/dist/chunk-J4ZPUCLX.mjs +0 -8
- package/dist/chunk-J4ZPUCLX.mjs.map +0 -1
- package/dist/chunk-JMDSN227.mjs +0 -25
- package/dist/chunk-JMDSN227.mjs.map +0 -1
- package/dist/chunk-K7MK6LQU.js +0 -54
- package/dist/chunk-K7MK6LQU.js.map +0 -1
- package/dist/chunk-KIQOUUEZ.mjs +0 -1
- package/dist/chunk-KIQOUUEZ.mjs.map +0 -1
- package/dist/chunk-KOPPL55J.mjs +0 -28
- package/dist/chunk-KOPPL55J.mjs.map +0 -1
- package/dist/chunk-KPRLFCKD.js +0 -13
- package/dist/chunk-KPRLFCKD.js.map +0 -1
- package/dist/chunk-LACTK6EO.js +0 -33
- package/dist/chunk-LACTK6EO.js.map +0 -1
- package/dist/chunk-LB4R3BUA.mjs +0 -36
- package/dist/chunk-LB4R3BUA.mjs.map +0 -1
- package/dist/chunk-LBC2OGSN.js +0 -48
- package/dist/chunk-LBC2OGSN.js.map +0 -1
- package/dist/chunk-LPMHPAZK.js +0 -203
- package/dist/chunk-LPMHPAZK.js.map +0 -1
- package/dist/chunk-LSKT2AUS.mjs +0 -97
- package/dist/chunk-LSKT2AUS.mjs.map +0 -1
- package/dist/chunk-LVNNGMJ2.mjs +0 -13
- package/dist/chunk-LVNNGMJ2.mjs.map +0 -1
- package/dist/chunk-MF43OG3Z.mjs +0 -1
- package/dist/chunk-MF43OG3Z.mjs.map +0 -1
- package/dist/chunk-MPZOXW6I.mjs +0 -48
- package/dist/chunk-MPZOXW6I.mjs.map +0 -1
- package/dist/chunk-N6MAO223.js +0 -60
- package/dist/chunk-N6MAO223.js.map +0 -1
- package/dist/chunk-NTOY6Y4Q.mjs +0 -1
- package/dist/chunk-NTOY6Y4Q.mjs.map +0 -1
- package/dist/chunk-OHRFO2BL.mjs +0 -89
- package/dist/chunk-OHRFO2BL.mjs.map +0 -1
- package/dist/chunk-OO6IVUCV.js +0 -104
- package/dist/chunk-OO6IVUCV.js.map +0 -1
- package/dist/chunk-ORR7AE5X.mjs +0 -54
- package/dist/chunk-ORR7AE5X.mjs.map +0 -1
- package/dist/chunk-PDOVVC74.mjs +0 -153
- package/dist/chunk-PDOVVC74.mjs.map +0 -1
- package/dist/chunk-PHUTP7NB.js +0 -25
- package/dist/chunk-PHUTP7NB.js.map +0 -1
- package/dist/chunk-Q2OQXAUM.mjs +0 -35
- package/dist/chunk-Q2OQXAUM.mjs.map +0 -1
- package/dist/chunk-Q3I6P2ZF.mjs +0 -167
- package/dist/chunk-Q3I6P2ZF.mjs.map +0 -1
- package/dist/chunk-QRVFWATH.mjs +0 -14
- package/dist/chunk-QRVFWATH.mjs.map +0 -1
- package/dist/chunk-QYHQ2WWX.js +0 -89
- package/dist/chunk-QYHQ2WWX.js.map +0 -1
- package/dist/chunk-RJNNNCZJ.js +0 -39
- package/dist/chunk-RJNNNCZJ.js.map +0 -1
- package/dist/chunk-ROCGQYSK.mjs +0 -203
- package/dist/chunk-ROCGQYSK.mjs.map +0 -1
- package/dist/chunk-RQKT6BQ2.mjs +0 -1
- package/dist/chunk-RQKT6BQ2.mjs.map +0 -1
- package/dist/chunk-S2HLITUN.js +0 -1
- package/dist/chunk-S2HLITUN.js.map +0 -1
- package/dist/chunk-SB5EPHE3.js +0 -41
- package/dist/chunk-SB5EPHE3.js.map +0 -1
- package/dist/chunk-SLU4FNKX.mjs +0 -60
- package/dist/chunk-SLU4FNKX.mjs.map +0 -1
- package/dist/chunk-SNXRXX2O.js +0 -30
- package/dist/chunk-SNXRXX2O.js.map +0 -1
- package/dist/chunk-SW65QYFV.js +0 -50
- package/dist/chunk-SW65QYFV.js.map +0 -1
- package/dist/chunk-TGZ7WOTJ.mjs +0 -1
- package/dist/chunk-TGZ7WOTJ.mjs.map +0 -1
- package/dist/chunk-TZB4LBT7.js +0 -8
- package/dist/chunk-TZB4LBT7.js.map +0 -1
- package/dist/chunk-UDOXICJK.mjs +0 -1
- package/dist/chunk-UDOXICJK.mjs.map +0 -1
- package/dist/chunk-VHJZERIC.js +0 -1
- package/dist/chunk-VHJZERIC.js.map +0 -1
- package/dist/chunk-VOYBI6T4.mjs +0 -22
- package/dist/chunk-VOYBI6T4.mjs.map +0 -1
- package/dist/chunk-WDYPMEZB.js +0 -22
- package/dist/chunk-WDYPMEZB.js.map +0 -1
- package/dist/chunk-WHGYMK5B.js +0 -1
- package/dist/chunk-WHGYMK5B.js.map +0 -1
- package/dist/chunk-WZ57PU2K.js +0 -97
- package/dist/chunk-WZ57PU2K.js.map +0 -1
- package/dist/chunk-XAOCS6ZD.js +0 -69
- package/dist/chunk-XAOCS6ZD.js.map +0 -1
- package/dist/chunk-XK5HPZZC.mjs +0 -14
- package/dist/chunk-XK5HPZZC.mjs.map +0 -1
- package/dist/chunk-XP4YGQJA.js +0 -14
- package/dist/chunk-XP4YGQJA.js.map +0 -1
- package/dist/chunk-Y2U3ZPCK.js +0 -181
- package/dist/chunk-Y2U3ZPCK.js.map +0 -1
- package/dist/chunk-Y3JC4WGW.js +0 -35
- package/dist/chunk-Y3JC4WGW.js.map +0 -1
- package/dist/chunk-ZG33OGC3.mjs +0 -1
- package/dist/chunk-ZG33OGC3.mjs.map +0 -1
- package/dist/chunk-ZJQSGRNK.mjs +0 -34
- package/dist/chunk-ZJQSGRNK.mjs.map +0 -1
- package/dist/chunk-ZTX624YO.js +0 -1
- package/dist/chunk-ZTX624YO.js.map +0 -1
- package/dist/environment.js +0 -46
- package/dist/environment.js.map +0 -1
- package/dist/global.js +0 -2
- package/dist/global.js.map +0 -1
- package/dist/helpers.js +0 -57
- package/dist/helpers.js.map +0 -1
- package/dist/index.js +0 -68
- package/dist/index.js.map +0 -1
- package/dist/internals/environment.js +0 -8
- package/dist/internals/environment.js.map +0 -1
- package/dist/internals/index.js +0 -150
- package/dist/internals/index.js.map +0 -1
- package/dist/internals/logger.js +0 -8
- package/dist/internals/logger.js.map +0 -1
- package/dist/internals/request.js +0 -42
- package/dist/internals/request.js.map +0 -1
- package/dist/internals/server.js +0 -9
- package/dist/internals/server.js.map +0 -1
- package/dist/internals/simulation/constants.js +0 -14
- package/dist/internals/simulation/constants.js.map +0 -1
- package/dist/internals/simulation/controllers.js +0 -25
- package/dist/internals/simulation/controllers.js.map +0 -1
- package/dist/internals/simulation/files.js +0 -14
- package/dist/internals/simulation/files.js.map +0 -1
- package/dist/internals/simulation/index.js +0 -111
- package/dist/internals/simulation/index.js.map +0 -1
- package/dist/internals/simulation/interface.js +0 -37
- package/dist/internals/simulation/interface.js.map +0 -1
- package/dist/internals/simulation/methods/constants.js +0 -12
- package/dist/internals/simulation/methods/constants.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/get-preferences.js +0 -8
- package/dist/internals/simulation/methods/hooks/get-preferences.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/index.js +0 -39
- package/dist/internals/simulation/methods/hooks/index.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/interface.js +0 -10
- package/dist/internals/simulation/methods/hooks/interface.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/notifications.js +0 -16
- package/dist/internals/simulation/methods/hooks/notifications.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/request-user-approval.js +0 -14
- package/dist/internals/simulation/methods/hooks/request-user-approval.js.map +0 -1
- package/dist/internals/simulation/methods/hooks/state.js +0 -18
- package/dist/internals/simulation/methods/hooks/state.js.map +0 -1
- package/dist/internals/simulation/methods/index.js +0 -28
- package/dist/internals/simulation/methods/index.js.map +0 -1
- package/dist/internals/simulation/methods/specifications.js +0 -27
- package/dist/internals/simulation/methods/specifications.js.map +0 -1
- package/dist/internals/simulation/middleware/engine.js +0 -15
- package/dist/internals/simulation/middleware/engine.js.map +0 -1
- package/dist/internals/simulation/middleware/index.js +0 -16
- package/dist/internals/simulation/middleware/index.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/accounts.js +0 -8
- package/dist/internals/simulation/middleware/internal-methods/accounts.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/index.js +0 -11
- package/dist/internals/simulation/middleware/internal-methods/index.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/middleware.js +0 -10
- package/dist/internals/simulation/middleware/internal-methods/middleware.js.map +0 -1
- package/dist/internals/simulation/middleware/internal-methods/provider-state.js +0 -8
- package/dist/internals/simulation/middleware/internal-methods/provider-state.js.map +0 -1
- package/dist/internals/simulation/middleware/mock.js +0 -9
- package/dist/internals/simulation/middleware/mock.js.map +0 -1
- package/dist/internals/simulation/options.js +0 -9
- package/dist/internals/simulation/options.js.map +0 -1
- package/dist/internals/simulation/simulation.js +0 -39
- package/dist/internals/simulation/simulation.js.map +0 -1
- package/dist/internals/simulation/store/index.js +0 -44
- package/dist/internals/simulation/store/index.js.map +0 -1
- package/dist/internals/simulation/store/mocks.js +0 -16
- package/dist/internals/simulation/store/mocks.js.map +0 -1
- package/dist/internals/simulation/store/notifications.js +0 -16
- package/dist/internals/simulation/store/notifications.js.map +0 -1
- package/dist/internals/simulation/store/state.js +0 -14
- package/dist/internals/simulation/store/state.js.map +0 -1
- package/dist/internals/simulation/store/store.js +0 -12
- package/dist/internals/simulation/store/store.js.map +0 -1
- package/dist/internals/simulation/store/ui.js +0 -16
- package/dist/internals/simulation/store/ui.js.map +0 -1
- package/dist/internals/structs.js +0 -22
- package/dist/internals/structs.js.map +0 -1
- package/dist/matchers.js +0 -49
- package/dist/matchers.js.map +0 -1
- package/dist/options.js +0 -8
- package/dist/options.js.map +0 -1
- package/dist/setup.js +0 -38
- package/dist/setup.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/index.d.ts +0 -5
- package/dist/types/internals/index.d.ts +0 -6
- package/dist/types/internals/simulation/index.d.ts +0 -5
- package/dist/types/internals/simulation/methods/hooks/index.d.ts +0 -5
- package/dist/types/internals/simulation/methods/index.d.ts +0 -1
- package/dist/types/internals/simulation/middleware/index.d.ts +0 -1
- package/dist/types/internals/simulation/middleware/internal-methods/index.d.ts +0 -1
- package/dist/types/internals/simulation/store/index.d.ts +0 -4
- package/dist/types/setup.d.ts +0 -1
- package/dist/types/vendor/readable-stream.d.js +0 -1
- package/dist/types/vendor/readable-stream.d.js.map +0 -1
- package/dist/types/vendor/readable-stream.d.mjs +0 -1
- package/dist/types/vendor/readable-stream.d.mjs.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -2
- package/dist/types.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,10 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [8.3.1]
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fix ESM version of the package ([#2682](https://github.com/MetaMask/snaps/pull/2682))
|
|
12
|
+
- This fixes the ESM version of the package to be fully compliant with the ESM
|
|
13
|
+
standard.
|
|
14
|
+
- Bump `@metamask/utils` from `^9.1.0` to `^9.2.1` ([#2680](https://github.com/MetaMask/snaps/pull/2680))
|
|
15
|
+
- Bump other MetaMask dependencies ([#2703](https://github.com/MetaMask/snaps/pull/2703))
|
|
16
|
+
|
|
9
17
|
## [8.3.0]
|
|
10
18
|
### Added
|
|
11
19
|
- Add support for `snap_getPreferences` ([#2607](https://github.com/MetaMask/snaps/pull/2607))
|
|
12
|
-
- Add `
|
|
20
|
+
- Add `RadioGroup` component ([#2592](https://github.com/MetaMask/snaps/pull/2592))
|
|
13
21
|
- Add support for custom dialogs in `snaps-jest` ([#2526](https://github.com/MetaMask/snaps/pull/2526), [#2509](https://github.com/MetaMask/snaps/pull/2509))
|
|
14
22
|
|
|
15
23
|
### Changed
|
|
@@ -181,7 +189,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
181
189
|
- The version of the package no longer needs to match the version of all other
|
|
182
190
|
MetaMask Snaps packages.
|
|
183
191
|
|
|
184
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@8.3.
|
|
192
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@8.3.1...HEAD
|
|
193
|
+
[8.3.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@8.3.0...@metamask/snaps-jest@8.3.1
|
|
185
194
|
[8.3.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@8.2.0...@metamask/snaps-jest@8.3.0
|
|
186
195
|
[8.2.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@8.1.3...@metamask/snaps-jest@8.2.0
|
|
187
196
|
[8.1.3]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-jest@8.1.2...@metamask/snaps-jest@8.1.3
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
var _SnapsEnvironment_options, _SnapsEnvironment_server, _SnapsEnvironment_instance;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.SnapsEnvironment = void 0;
|
|
19
|
+
const utils_1 = require("@metamask/utils");
|
|
20
|
+
const jest_environment_node_1 = __importDefault(require("jest-environment-node"));
|
|
21
|
+
const internals_1 = require("./internals/index.cjs");
|
|
22
|
+
const options_1 = require("./options.cjs");
|
|
23
|
+
/* eslint-enable */
|
|
24
|
+
const log = (0, utils_1.createModuleLogger)(internals_1.rootLogger, 'environment');
|
|
25
|
+
class SnapsEnvironment extends jest_environment_node_1.default {
|
|
26
|
+
/**
|
|
27
|
+
* Constructor.
|
|
28
|
+
*
|
|
29
|
+
* @param options - The environment options.
|
|
30
|
+
* @param context - The environment context.
|
|
31
|
+
*/
|
|
32
|
+
constructor(options, context) {
|
|
33
|
+
super(options, context);
|
|
34
|
+
_SnapsEnvironment_options.set(this, void 0);
|
|
35
|
+
_SnapsEnvironment_server.set(this, void 0);
|
|
36
|
+
_SnapsEnvironment_instance.set(this, void 0);
|
|
37
|
+
__classPrivateFieldSet(this, _SnapsEnvironment_options, (0, options_1.getOptions)(options.projectConfig.testEnvironmentOptions), "f");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Set up the environment. This starts the built-in HTTP server, and creates a
|
|
41
|
+
* new browser instance.
|
|
42
|
+
*/
|
|
43
|
+
async setup() {
|
|
44
|
+
await super.setup();
|
|
45
|
+
if (__classPrivateFieldGet(this, _SnapsEnvironment_options, "f").server.enabled) {
|
|
46
|
+
log('Starting server.');
|
|
47
|
+
__classPrivateFieldSet(this, _SnapsEnvironment_server, await (0, internals_1.startServer)(__classPrivateFieldGet(this, _SnapsEnvironment_options, "f").server), "f");
|
|
48
|
+
}
|
|
49
|
+
this.global.snapsEnvironment = this;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Tear down the environment. This closes the browser, and stops the built-in
|
|
53
|
+
* HTTP server.
|
|
54
|
+
*/
|
|
55
|
+
async teardown() {
|
|
56
|
+
await __classPrivateFieldGet(this, _SnapsEnvironment_instance, "f")?.executionService.terminateAllSnaps();
|
|
57
|
+
__classPrivateFieldGet(this, _SnapsEnvironment_server, "f")?.close();
|
|
58
|
+
await super.teardown();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Install a Snap in the environment. This will terminate any previously
|
|
62
|
+
* installed Snaps, and run the Snap code in a new execution service.
|
|
63
|
+
*
|
|
64
|
+
* @param snapId - The ID of the Snap to install.
|
|
65
|
+
* @param options - The options to use when installing the Snap.
|
|
66
|
+
* @param options.executionService - The execution service to use.
|
|
67
|
+
* @param options.executionServiceOptions - The options to use when creating the
|
|
68
|
+
* execution service, if any. This should only include options specific to the
|
|
69
|
+
* provided execution service.
|
|
70
|
+
* @param options.options - The simulation options.
|
|
71
|
+
* @template Service - The type of the execution service.
|
|
72
|
+
* @returns The installed Snap.
|
|
73
|
+
*/
|
|
74
|
+
async installSnap(snapId = this.snapId, options = {}) {
|
|
75
|
+
await __classPrivateFieldGet(this, _SnapsEnvironment_instance, "f")?.executionService.terminateAllSnaps();
|
|
76
|
+
__classPrivateFieldSet(this, _SnapsEnvironment_instance, await (0, internals_1.handleInstallSnap)(snapId, options), "f");
|
|
77
|
+
return __classPrivateFieldGet(this, _SnapsEnvironment_instance, "f");
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get the snap ID for the current environment, which is used if no snap ID is
|
|
81
|
+
* passed to {@link installSnap}. This assumes that the built-in server is
|
|
82
|
+
* running.
|
|
83
|
+
*
|
|
84
|
+
* @returns The snap ID.
|
|
85
|
+
* @throws If the server is not running.
|
|
86
|
+
*/
|
|
87
|
+
get snapId() {
|
|
88
|
+
(0, utils_1.assert)(__classPrivateFieldGet(this, _SnapsEnvironment_server, "f"), 'You must specify a snap ID, because the built-in server is not running.');
|
|
89
|
+
const { port } = __classPrivateFieldGet(this, _SnapsEnvironment_server, "f").address();
|
|
90
|
+
return `local:http://localhost:${port}`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.SnapsEnvironment = SnapsEnvironment;
|
|
94
|
+
_SnapsEnvironment_options = new WeakMap(), _SnapsEnvironment_server = new WeakMap(), _SnapsEnvironment_instance = new WeakMap();
|
|
95
|
+
exports.default = SnapsEnvironment;
|
|
96
|
+
//# sourceMappingURL=environment.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.cjs","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAMA,2CAA6D;AAE7D,kFAAoD;AAIpD,qDAAyE;AAEzE,2CAAuC;AAMvC,mBAAmB;AAEnB,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAU,EAAE,aAAa,CAAC,CAAC;AAE1D,MAAa,gBAAiB,SAAQ,+BAAe;IAOnD;;;;;OAKG;IACH,YAAY,OAA8B,EAAE,OAA2B;QACrE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAb1B,4CAAkC;QAElC,2CAA4B;QAE5B,6CAAqC;QAUnC,uBAAA,IAAI,6BAAY,IAAA,oBAAU,EAAC,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,MAAA,CAAC;IAC3E,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QAEpB,IAAI,uBAAA,IAAI,iCAAS,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YACxB,uBAAA,IAAI,4BAAW,MAAM,IAAA,uBAAW,EAAC,uBAAA,IAAI,iCAAS,CAAC,MAAM,CAAC,MAAA,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,uBAAA,IAAI,kCAAU,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC3D,uBAAA,IAAI,gCAAQ,EAAE,KAAK,EAAE,CAAC;QACtB,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,WAAW,CAKf,SAAiB,IAAI,CAAC,MAAM,EAC5B,UAAgD,EAAE;QAElD,MAAM,uBAAA,IAAI,kCAAU,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC3D,uBAAA,IAAI,8BAAa,MAAM,IAAA,6BAAiB,EAAC,MAAgB,EAAE,OAAO,CAAC,MAAA,CAAC;QACpE,OAAO,uBAAA,IAAI,kCAAU,CAAC;IACxB,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,MAAM;QACR,IAAA,cAAM,EACJ,uBAAA,IAAI,gCAAQ,EACZ,yEAAyE,CAC1E,CAAC;QAEF,MAAM,EAAE,IAAI,EAAE,GAAG,uBAAA,IAAI,gCAAQ,CAAC,OAAO,EAAiB,CAAC;QACvD,OAAO,0BAA0B,IAAI,EAAE,CAAC;IAC1C,CAAC;CACF;AAvFD,4CAuFC;;AAED,kBAAe,gBAAgB,CAAC","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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { EnvironmentContext, JestEnvironmentConfig } from
|
|
2
|
-
import type { AbstractExecutionService } from
|
|
3
|
-
import NodeEnvironment from
|
|
4
|
-
import type { InstalledSnap, InstallSnapOptions } from
|
|
1
|
+
import type { EnvironmentContext, JestEnvironmentConfig } from "@jest/environment";
|
|
2
|
+
import type { AbstractExecutionService } from "@metamask/snaps-controllers";
|
|
3
|
+
import NodeEnvironment from "jest-environment-node";
|
|
4
|
+
import type { InstalledSnap, InstallSnapOptions } from "./internals/index.cjs";
|
|
5
5
|
declare global {
|
|
6
6
|
const snapsEnvironment: SnapsEnvironment;
|
|
7
7
|
}
|
|
@@ -50,3 +50,4 @@ export declare class SnapsEnvironment extends NodeEnvironment {
|
|
|
50
50
|
get snapId(): string;
|
|
51
51
|
}
|
|
52
52
|
export default SnapsEnvironment;
|
|
53
|
+
//# sourceMappingURL=environment.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.cts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,0BAA0B;AAC3B,OAAO,KAAK,EAAE,wBAAwB,EAAE,oCAAoC;AAI5E,OAAO,eAAe,8BAA8B;AAGpD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,8BAAoB;AAMrE,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,gBAAgB,EAAE,gBAAgB,CAAC;CAC1C;AAKD,qBAAa,gBAAiB,SAAQ,eAAe;;IAOnD;;;;;OAKG;gBACS,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB;IAKvE;;;OAGG;IACG,KAAK;IAWX;;;OAGG;IACG,QAAQ;IAMd;;;;;;;;;;;;;OAaG;IACG,WAAW,CACf,OAAO,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAClD,OAAO,wBAAwB,CAChC,EAED,MAAM,GAAE,MAAoB,EAC5B,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAM;IAOpD;;;;;;;OAOG;IACH,IAAI,MAAM,WAQT;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { EnvironmentContext, JestEnvironmentConfig } from "@jest/environment";
|
|
2
|
+
import type { AbstractExecutionService } from "@metamask/snaps-controllers";
|
|
3
|
+
import NodeEnvironment from "jest-environment-node";
|
|
4
|
+
import type { InstalledSnap, InstallSnapOptions } from "./internals/index.mjs";
|
|
5
|
+
declare global {
|
|
6
|
+
const snapsEnvironment: SnapsEnvironment;
|
|
7
|
+
}
|
|
8
|
+
export declare class SnapsEnvironment extends NodeEnvironment {
|
|
9
|
+
#private;
|
|
10
|
+
/**
|
|
11
|
+
* Constructor.
|
|
12
|
+
*
|
|
13
|
+
* @param options - The environment options.
|
|
14
|
+
* @param context - The environment context.
|
|
15
|
+
*/
|
|
16
|
+
constructor(options: JestEnvironmentConfig, context: EnvironmentContext);
|
|
17
|
+
/**
|
|
18
|
+
* Set up the environment. This starts the built-in HTTP server, and creates a
|
|
19
|
+
* new browser instance.
|
|
20
|
+
*/
|
|
21
|
+
setup(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Tear down the environment. This closes the browser, and stops the built-in
|
|
24
|
+
* HTTP server.
|
|
25
|
+
*/
|
|
26
|
+
teardown(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Install a Snap in the environment. This will terminate any previously
|
|
29
|
+
* installed Snaps, and run the Snap code in a new execution service.
|
|
30
|
+
*
|
|
31
|
+
* @param snapId - The ID of the Snap to install.
|
|
32
|
+
* @param options - The options to use when installing the Snap.
|
|
33
|
+
* @param options.executionService - The execution service to use.
|
|
34
|
+
* @param options.executionServiceOptions - The options to use when creating the
|
|
35
|
+
* execution service, if any. This should only include options specific to the
|
|
36
|
+
* provided execution service.
|
|
37
|
+
* @param options.options - The simulation options.
|
|
38
|
+
* @template Service - The type of the execution service.
|
|
39
|
+
* @returns The installed Snap.
|
|
40
|
+
*/
|
|
41
|
+
installSnap<Service extends new (...args: any[]) => InstanceType<typeof AbstractExecutionService>>(snapId?: string, options?: Partial<InstallSnapOptions<Service>>): Promise<InstalledSnap>;
|
|
42
|
+
/**
|
|
43
|
+
* Get the snap ID for the current environment, which is used if no snap ID is
|
|
44
|
+
* passed to {@link installSnap}. This assumes that the built-in server is
|
|
45
|
+
* running.
|
|
46
|
+
*
|
|
47
|
+
* @returns The snap ID.
|
|
48
|
+
* @throws If the server is not running.
|
|
49
|
+
*/
|
|
50
|
+
get snapId(): string;
|
|
51
|
+
}
|
|
52
|
+
export default SnapsEnvironment;
|
|
53
|
+
//# sourceMappingURL=environment.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.mts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,0BAA0B;AAC3B,OAAO,KAAK,EAAE,wBAAwB,EAAE,oCAAoC;AAI5E,OAAO,eAAe,8BAA8B;AAGpD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,8BAAoB;AAMrE,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,gBAAgB,EAAE,gBAAgB,CAAC;CAC1C;AAKD,qBAAa,gBAAiB,SAAQ,eAAe;;IAOnD;;;;;OAKG;gBACS,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB;IAKvE;;;OAGG;IACG,KAAK;IAWX;;;OAGG;IACG,QAAQ;IAMd;;;;;;;;;;;;;OAaG;IACG,WAAW,CACf,OAAO,SAAS,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,CAClD,OAAO,wBAAwB,CAChC,EAED,MAAM,GAAE,MAAoB,EAC5B,OAAO,GAAE,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAM;IAOpD;;;;;;;OAOG;IACH,IAAI,MAAM,WAQT;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
package/dist/environment.mjs
CHANGED
|
@@ -1,46 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "./chunk-MF43OG3Z.mjs";
|
|
7
|
-
import "./chunk-XK5HPZZC.mjs";
|
|
8
|
-
import "./chunk-PDOVVC74.mjs";
|
|
9
|
-
import "./chunk-5ZFHFICZ.mjs";
|
|
10
|
-
import "./chunk-Q3I6P2ZF.mjs";
|
|
11
|
-
import "./chunk-ZG33OGC3.mjs";
|
|
12
|
-
import "./chunk-3J2IBWXV.mjs";
|
|
13
|
-
import "./chunk-6HHV6YFQ.mjs";
|
|
14
|
-
import "./chunk-Q2OQXAUM.mjs";
|
|
15
|
-
import "./chunk-VOYBI6T4.mjs";
|
|
16
|
-
import "./chunk-IXKO6X55.mjs";
|
|
17
|
-
import "./chunk-FP4H3ADT.mjs";
|
|
18
|
-
import "./chunk-6JPBXAHM.mjs";
|
|
19
|
-
import "./chunk-IWJ4HKDR.mjs";
|
|
20
|
-
import "./chunk-G333FBBL.mjs";
|
|
21
|
-
import "./chunk-SLU4FNKX.mjs";
|
|
22
|
-
import "./chunk-J4ZPUCLX.mjs";
|
|
23
|
-
import "./chunk-C26TYXXD.mjs";
|
|
24
|
-
import "./chunk-LVNNGMJ2.mjs";
|
|
25
|
-
import "./chunk-LSKT2AUS.mjs";
|
|
26
|
-
import "./chunk-NTOY6Y4Q.mjs";
|
|
27
|
-
import "./chunk-OHRFO2BL.mjs";
|
|
28
|
-
import "./chunk-UDOXICJK.mjs";
|
|
29
|
-
import "./chunk-QRVFWATH.mjs";
|
|
30
|
-
import "./chunk-FQWOVTBB.mjs";
|
|
31
|
-
import "./chunk-ALRZENWP.mjs";
|
|
32
|
-
import "./chunk-24CGIQLL.mjs";
|
|
33
|
-
import "./chunk-5U5WB3SM.mjs";
|
|
34
|
-
import "./chunk-RQKT6BQ2.mjs";
|
|
35
|
-
import "./chunk-ORR7AE5X.mjs";
|
|
36
|
-
import "./chunk-ZJQSGRNK.mjs";
|
|
37
|
-
import "./chunk-H2464AXT.mjs";
|
|
38
|
-
import "./chunk-LB4R3BUA.mjs";
|
|
39
|
-
import "./chunk-MPZOXW6I.mjs";
|
|
40
|
-
import "./chunk-57SGDM5B.mjs";
|
|
41
|
-
import "./chunk-JMDSN227.mjs";
|
|
42
|
-
export {
|
|
43
|
-
SnapsEnvironment,
|
|
44
|
-
environment_default as default
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
45
6
|
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _SnapsEnvironment_options, _SnapsEnvironment_server, _SnapsEnvironment_instance;
|
|
13
|
+
function $importDefault(module) {
|
|
14
|
+
if (module?.__esModule) {
|
|
15
|
+
return module.default;
|
|
16
|
+
}
|
|
17
|
+
return module;
|
|
18
|
+
}
|
|
19
|
+
import { assert, createModuleLogger } from "@metamask/utils";
|
|
20
|
+
import $NodeEnvironment from "jest-environment-node";
|
|
21
|
+
const NodeEnvironment = $importDefault($NodeEnvironment);
|
|
22
|
+
import { handleInstallSnap, rootLogger, startServer } from "./internals/index.mjs";
|
|
23
|
+
import { getOptions } from "./options.mjs";
|
|
24
|
+
/* eslint-enable */
|
|
25
|
+
const log = createModuleLogger(rootLogger, 'environment');
|
|
26
|
+
export class SnapsEnvironment extends NodeEnvironment {
|
|
27
|
+
/**
|
|
28
|
+
* Constructor.
|
|
29
|
+
*
|
|
30
|
+
* @param options - The environment options.
|
|
31
|
+
* @param context - The environment context.
|
|
32
|
+
*/
|
|
33
|
+
constructor(options, context) {
|
|
34
|
+
super(options, context);
|
|
35
|
+
_SnapsEnvironment_options.set(this, void 0);
|
|
36
|
+
_SnapsEnvironment_server.set(this, void 0);
|
|
37
|
+
_SnapsEnvironment_instance.set(this, void 0);
|
|
38
|
+
__classPrivateFieldSet(this, _SnapsEnvironment_options, getOptions(options.projectConfig.testEnvironmentOptions), "f");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Set up the environment. This starts the built-in HTTP server, and creates a
|
|
42
|
+
* new browser instance.
|
|
43
|
+
*/
|
|
44
|
+
async setup() {
|
|
45
|
+
await super.setup();
|
|
46
|
+
if (__classPrivateFieldGet(this, _SnapsEnvironment_options, "f").server.enabled) {
|
|
47
|
+
log('Starting server.');
|
|
48
|
+
__classPrivateFieldSet(this, _SnapsEnvironment_server, await startServer(__classPrivateFieldGet(this, _SnapsEnvironment_options, "f").server), "f");
|
|
49
|
+
}
|
|
50
|
+
this.global.snapsEnvironment = this;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Tear down the environment. This closes the browser, and stops the built-in
|
|
54
|
+
* HTTP server.
|
|
55
|
+
*/
|
|
56
|
+
async teardown() {
|
|
57
|
+
await __classPrivateFieldGet(this, _SnapsEnvironment_instance, "f")?.executionService.terminateAllSnaps();
|
|
58
|
+
__classPrivateFieldGet(this, _SnapsEnvironment_server, "f")?.close();
|
|
59
|
+
await super.teardown();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Install a Snap in the environment. This will terminate any previously
|
|
63
|
+
* installed Snaps, and run the Snap code in a new execution service.
|
|
64
|
+
*
|
|
65
|
+
* @param snapId - The ID of the Snap to install.
|
|
66
|
+
* @param options - The options to use when installing the Snap.
|
|
67
|
+
* @param options.executionService - The execution service to use.
|
|
68
|
+
* @param options.executionServiceOptions - The options to use when creating the
|
|
69
|
+
* execution service, if any. This should only include options specific to the
|
|
70
|
+
* provided execution service.
|
|
71
|
+
* @param options.options - The simulation options.
|
|
72
|
+
* @template Service - The type of the execution service.
|
|
73
|
+
* @returns The installed Snap.
|
|
74
|
+
*/
|
|
75
|
+
async installSnap(snapId = this.snapId, options = {}) {
|
|
76
|
+
await __classPrivateFieldGet(this, _SnapsEnvironment_instance, "f")?.executionService.terminateAllSnaps();
|
|
77
|
+
__classPrivateFieldSet(this, _SnapsEnvironment_instance, await handleInstallSnap(snapId, options), "f");
|
|
78
|
+
return __classPrivateFieldGet(this, _SnapsEnvironment_instance, "f");
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the snap ID for the current environment, which is used if no snap ID is
|
|
82
|
+
* passed to {@link installSnap}. This assumes that the built-in server is
|
|
83
|
+
* running.
|
|
84
|
+
*
|
|
85
|
+
* @returns The snap ID.
|
|
86
|
+
* @throws If the server is not running.
|
|
87
|
+
*/
|
|
88
|
+
get snapId() {
|
|
89
|
+
assert(__classPrivateFieldGet(this, _SnapsEnvironment_server, "f"), 'You must specify a snap ID, because the built-in server is not running.');
|
|
90
|
+
const { port } = __classPrivateFieldGet(this, _SnapsEnvironment_server, "f").address();
|
|
91
|
+
return `local:http://localhost:${port}`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
_SnapsEnvironment_options = new WeakMap(), _SnapsEnvironment_server = new WeakMap(), _SnapsEnvironment_instance = new WeakMap();
|
|
95
|
+
export default SnapsEnvironment;
|
|
46
96
|
//# sourceMappingURL=environment.mjs.map
|
package/dist/environment.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"environment.mjs","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAMA,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,wBAAwB;AAE7D,OAAO,gBAAe,8BAA8B;;AAIpD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,8BAAoB;AAEzE,OAAO,EAAE,UAAU,EAAE,sBAAkB;AAMvC,mBAAmB;AAEnB,MAAM,GAAG,GAAG,kBAAkB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAE1D,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IAOnD;;;;;OAKG;IACH,YAAY,OAA8B,EAAE,OAA2B;QACrE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAb1B,4CAAkC;QAElC,2CAA4B;QAE5B,6CAAqC;QAUnC,uBAAA,IAAI,6BAAY,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,sBAAsB,CAAC,MAAA,CAAC;IAC3E,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QAEpB,IAAI,uBAAA,IAAI,iCAAS,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACjC,GAAG,CAAC,kBAAkB,CAAC,CAAC;YACxB,uBAAA,IAAI,4BAAW,MAAM,WAAW,CAAC,uBAAA,IAAI,iCAAS,CAAC,MAAM,CAAC,MAAA,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,uBAAA,IAAI,kCAAU,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC3D,uBAAA,IAAI,gCAAQ,EAAE,KAAK,EAAE,CAAC;QACtB,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,WAAW,CAKf,SAAiB,IAAI,CAAC,MAAM,EAC5B,UAAgD,EAAE;QAElD,MAAM,uBAAA,IAAI,kCAAU,EAAE,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;QAC3D,uBAAA,IAAI,8BAAa,MAAM,iBAAiB,CAAC,MAAgB,EAAE,OAAO,CAAC,MAAA,CAAC;QACpE,OAAO,uBAAA,IAAI,kCAAU,CAAC;IACxB,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,MAAM;QACR,MAAM,CACJ,uBAAA,IAAI,gCAAQ,EACZ,yEAAyE,CAC1E,CAAC;QAEF,MAAM,EAAE,IAAI,EAAE,GAAG,uBAAA,IAAI,gCAAQ,CAAC,OAAO,EAAiB,CAAC;QACvD,OAAO,0BAA0B,IAAI,EAAE,CAAC;IAC1C,CAAC;CACF;;AAED,eAAe,gBAAgB,CAAC","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"]}
|
package/dist/global.cjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars, @typescript-eslint/no-namespace */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
//# sourceMappingURL=global.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.cjs","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":";AAAA,oNAAoN","sourcesContent":["/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars, @typescript-eslint/no-namespace */\n\nimport type {\n EnumToUnion,\n NotificationType,\n ComponentOrElement,\n} from '@metamask/snaps-sdk';\n\ninterface SnapsMatchers {\n /**\n * Assert that the response is a JSON-RPC response with the given result. This\n * is equivalent to calling `expect(response.result).toStrictEqual(result)`.\n *\n * @param response - The expected response result.\n * @throws If the response is not a JSON-RPC response with the given result.\n * @example\n * const response = await request({ method: 'foo' });\n * expect(response).toRespondWith('bar');\n */\n toRespondWith(response: unknown): void;\n\n /**\n * Assert that the response is a JSON-RPC response with the given error. This\n * is equivalent to calling `expect(response.error).toStrictEqual(error)`.\n *\n * @param error - The expected response error.\n * @throws If the response is not a JSON-RPC response with the given error.\n * @example\n * const response = await request({ method: 'foo' });\n * expect(response).toRespondWithError({\n * code: -32601,\n * message: 'The method does not exist / is not available.',\n * stack: expect.any(String),\n * data: { method: 'foo', cause: null },\n * });\n */\n toRespondWithError(error: unknown): void;\n\n /**\n * Assert that the Snap sent a notification with the expected message, and\n * optionally the expected notification type. This is equivalent to calling\n * `expect(response.notifications).toContainEqual({ message, type })`.\n *\n * @param message - The expected notification message.\n * @param type - The expected notification type, i.e., 'inApp' or 'native'. If\n * not provided, the type will be ignored.\n * @throws If the snap did not send a notification with the expected message.\n * @example\n * const response = await request({ method: 'foo' });\n * expect(response).toSendNotification('bar', NotificationType.InApp);\n */\n toSendNotification(\n message: string,\n type?: EnumToUnion<NotificationType>,\n ): void;\n\n /**\n * Assert that the Snap rendered the expected component. This is equivalent to\n * calling `expect(interface.content).toStrictEqual(component)`.\n *\n * @param component - The expected rendered component.\n * @throws If the snap did not render the expected component.\n * @example\n * const response = request({ method: 'foo' });\n * const ui = await response.getInterface();\n * expect(ui).toRender(panel([heading('Hello, world!')]));\n */\n toRender(component: ComponentOrElement): void;\n}\n\n// Extend the `expect` interface with the new matchers. This is used when\n// importing `expect` from `@jest/globals`.\ndeclare module 'expect' {\n interface AsymmetricMatchers extends SnapsMatchers {}\n\n // Ideally we would use `Matchers<Result>` instead of `Matchers<R>`, but\n // TypeScript doesn't allow this:\n // TS2428: All declarations of 'Matchers' must have identical type parameters.\n interface Matchers<R> extends SnapsMatchers {}\n}\n\n// Extend the Jest global namespace with the new matchers. This is used when\n// using the global `expect` function.\ndeclare global {\n namespace jest {\n // Ideally we would use `Matchers<Result>` instead of `Matchers<R>`, but\n // TypeScript doesn't allow this:\n // TS2428: All declarations of 'Matchers' must have identical type parameters.\n interface Matchers<R> extends SnapsMatchers {}\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnumToUnion, NotificationType, ComponentOrElement } from
|
|
1
|
+
import type { EnumToUnion, NotificationType, ComponentOrElement } from "@metamask/snaps-sdk";
|
|
2
2
|
interface SnapsMatchers {
|
|
3
3
|
/**
|
|
4
4
|
* Assert that the response is a JSON-RPC response with the given result. This
|
|
@@ -67,3 +67,4 @@ declare global {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
export {};
|
|
70
|
+
//# sourceMappingURL=global.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.cts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EACnB,4BAA4B;AAE7B,UAAU,aAAa;IACrB;;;;;;;;;OASG;IACH,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvC;;;;;;;;;;;;;;OAcG;IACH,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAEzC;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,GACnC,IAAI,CAAC;IAER;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC/C;AAID,OAAO,QAAQ,QAAQ,CAAC;IACtB,UAAU,kBAAmB,SAAQ,aAAa;KAAG;IAKrD,UAAU,QAAQ,CAAC,CAAC,CAAE,SAAQ,aAAa;KAAG;CAC/C;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,IAAI,CAAC;QAIb,UAAU,QAAQ,CAAC,CAAC,CAAE,SAAQ,aAAa;SAAG;KAC/C;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { EnumToUnion, NotificationType, ComponentOrElement } from "@metamask/snaps-sdk";
|
|
2
|
+
interface SnapsMatchers {
|
|
3
|
+
/**
|
|
4
|
+
* Assert that the response is a JSON-RPC response with the given result. This
|
|
5
|
+
* is equivalent to calling `expect(response.result).toStrictEqual(result)`.
|
|
6
|
+
*
|
|
7
|
+
* @param response - The expected response result.
|
|
8
|
+
* @throws If the response is not a JSON-RPC response with the given result.
|
|
9
|
+
* @example
|
|
10
|
+
* const response = await request({ method: 'foo' });
|
|
11
|
+
* expect(response).toRespondWith('bar');
|
|
12
|
+
*/
|
|
13
|
+
toRespondWith(response: unknown): void;
|
|
14
|
+
/**
|
|
15
|
+
* Assert that the response is a JSON-RPC response with the given error. This
|
|
16
|
+
* is equivalent to calling `expect(response.error).toStrictEqual(error)`.
|
|
17
|
+
*
|
|
18
|
+
* @param error - The expected response error.
|
|
19
|
+
* @throws If the response is not a JSON-RPC response with the given error.
|
|
20
|
+
* @example
|
|
21
|
+
* const response = await request({ method: 'foo' });
|
|
22
|
+
* expect(response).toRespondWithError({
|
|
23
|
+
* code: -32601,
|
|
24
|
+
* message: 'The method does not exist / is not available.',
|
|
25
|
+
* stack: expect.any(String),
|
|
26
|
+
* data: { method: 'foo', cause: null },
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
toRespondWithError(error: unknown): void;
|
|
30
|
+
/**
|
|
31
|
+
* Assert that the Snap sent a notification with the expected message, and
|
|
32
|
+
* optionally the expected notification type. This is equivalent to calling
|
|
33
|
+
* `expect(response.notifications).toContainEqual({ message, type })`.
|
|
34
|
+
*
|
|
35
|
+
* @param message - The expected notification message.
|
|
36
|
+
* @param type - The expected notification type, i.e., 'inApp' or 'native'. If
|
|
37
|
+
* not provided, the type will be ignored.
|
|
38
|
+
* @throws If the snap did not send a notification with the expected message.
|
|
39
|
+
* @example
|
|
40
|
+
* const response = await request({ method: 'foo' });
|
|
41
|
+
* expect(response).toSendNotification('bar', NotificationType.InApp);
|
|
42
|
+
*/
|
|
43
|
+
toSendNotification(message: string, type?: EnumToUnion<NotificationType>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Assert that the Snap rendered the expected component. This is equivalent to
|
|
46
|
+
* calling `expect(interface.content).toStrictEqual(component)`.
|
|
47
|
+
*
|
|
48
|
+
* @param component - The expected rendered component.
|
|
49
|
+
* @throws If the snap did not render the expected component.
|
|
50
|
+
* @example
|
|
51
|
+
* const response = request({ method: 'foo' });
|
|
52
|
+
* const ui = await response.getInterface();
|
|
53
|
+
* expect(ui).toRender(panel([heading('Hello, world!')]));
|
|
54
|
+
*/
|
|
55
|
+
toRender(component: ComponentOrElement): void;
|
|
56
|
+
}
|
|
57
|
+
declare module 'expect' {
|
|
58
|
+
interface AsymmetricMatchers extends SnapsMatchers {
|
|
59
|
+
}
|
|
60
|
+
interface Matchers<R> extends SnapsMatchers {
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
declare global {
|
|
64
|
+
namespace jest {
|
|
65
|
+
interface Matchers<R> extends SnapsMatchers {
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=global.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.mts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EACnB,4BAA4B;AAE7B,UAAU,aAAa;IACrB;;;;;;;;;OASG;IACH,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvC;;;;;;;;;;;;;;OAcG;IACH,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAEzC;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,GACnC,IAAI,CAAC;IAER;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC/C;AAID,OAAO,QAAQ,QAAQ,CAAC;IACtB,UAAU,kBAAmB,SAAQ,aAAa;KAAG;IAKrD,UAAU,QAAQ,CAAC,CAAC,CAAE,SAAQ,aAAa;KAAG;CAC/C;AAID,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,IAAI,CAAC;QAIb,UAAU,QAAQ,CAAC,CAAC,CAAE,SAAQ,aAAa;SAAG;KAC/C;CACF"}
|
package/dist/global.mjs
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars, @typescript-eslint/no-namespace */
|
|
2
|
+
export {};
|
|
2
3
|
//# sourceMappingURL=global.mjs.map
|
package/dist/global.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"global.mjs","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA,oNAAoN","sourcesContent":["/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/naming-convention, @typescript-eslint/no-empty-interface, @typescript-eslint/no-unused-vars, @typescript-eslint/no-namespace */\n\nimport type {\n EnumToUnion,\n NotificationType,\n ComponentOrElement,\n} from '@metamask/snaps-sdk';\n\ninterface SnapsMatchers {\n /**\n * Assert that the response is a JSON-RPC response with the given result. This\n * is equivalent to calling `expect(response.result).toStrictEqual(result)`.\n *\n * @param response - The expected response result.\n * @throws If the response is not a JSON-RPC response with the given result.\n * @example\n * const response = await request({ method: 'foo' });\n * expect(response).toRespondWith('bar');\n */\n toRespondWith(response: unknown): void;\n\n /**\n * Assert that the response is a JSON-RPC response with the given error. This\n * is equivalent to calling `expect(response.error).toStrictEqual(error)`.\n *\n * @param error - The expected response error.\n * @throws If the response is not a JSON-RPC response with the given error.\n * @example\n * const response = await request({ method: 'foo' });\n * expect(response).toRespondWithError({\n * code: -32601,\n * message: 'The method does not exist / is not available.',\n * stack: expect.any(String),\n * data: { method: 'foo', cause: null },\n * });\n */\n toRespondWithError(error: unknown): void;\n\n /**\n * Assert that the Snap sent a notification with the expected message, and\n * optionally the expected notification type. This is equivalent to calling\n * `expect(response.notifications).toContainEqual({ message, type })`.\n *\n * @param message - The expected notification message.\n * @param type - The expected notification type, i.e., 'inApp' or 'native'. If\n * not provided, the type will be ignored.\n * @throws If the snap did not send a notification with the expected message.\n * @example\n * const response = await request({ method: 'foo' });\n * expect(response).toSendNotification('bar', NotificationType.InApp);\n */\n toSendNotification(\n message: string,\n type?: EnumToUnion<NotificationType>,\n ): void;\n\n /**\n * Assert that the Snap rendered the expected component. This is equivalent to\n * calling `expect(interface.content).toStrictEqual(component)`.\n *\n * @param component - The expected rendered component.\n * @throws If the snap did not render the expected component.\n * @example\n * const response = request({ method: 'foo' });\n * const ui = await response.getInterface();\n * expect(ui).toRender(panel([heading('Hello, world!')]));\n */\n toRender(component: ComponentOrElement): void;\n}\n\n// Extend the `expect` interface with the new matchers. This is used when\n// importing `expect` from `@jest/globals`.\ndeclare module 'expect' {\n interface AsymmetricMatchers extends SnapsMatchers {}\n\n // Ideally we would use `Matchers<Result>` instead of `Matchers<R>`, but\n // TypeScript doesn't allow this:\n // TS2428: All declarations of 'Matchers' must have identical type parameters.\n interface Matchers<R> extends SnapsMatchers {}\n}\n\n// Extend the Jest global namespace with the new matchers. This is used when\n// using the global `expect` function.\ndeclare global {\n namespace jest {\n // Ideally we would use `Matchers<Result>` instead of `Matchers<R>`, but\n // TypeScript doesn't allow this:\n // TS2428: All declarations of 'Matchers' must have identical type parameters.\n interface Matchers<R> extends SnapsMatchers {}\n }\n}\n"]}
|