MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
727 stars 556 forks source link

Fix regressions introduced by `@metamask/providers@17.1.1` #2579

Closed MajorLift closed 2 months ago

MajorLift commented 3 months ago

Description

Bumping @metamask/providers 17.0.0 to ^17.1.1 causes the following regressions in lavamoat build and snaps-execution-environment wdio browser tests.

  1. Lavamoat build errors triggered by dist subpath imports from @metamask/providers
Error#1: Can't walk dependency graph: Cannot find module '@metamask/providers/dist/StreamProvider' from '/Volumes/Code/metamask/snaps/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts'

MetaMask/snaps/actions/runs/9946111549/job/27475887863?pr=2445

  1. snaps-execution-environment wdio browser test failures:
[0-5]  Error:  Test failed due to the following error: [plugin:vite:import-analysis] Missing "./dist/StreamProvider.cjs" specifier in "@metamask/providers" package
/home/runner/work/snaps/snaps/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts

MetaMask/snaps/actions/runs/9946262075/job/27476487392?pr=2445

  1. snaps-execution-environment wdio browser test failures
yarn workspace @metamask/snaps-execution-environments test:browser

Execution of 7 workers started at 2024-07-15T20:52:44.865Z

[0-0] RUNNING in chrome - file:///src/common/BaseSnapExecutor.test.browser.ts
2024-07-15T20:52:47.726Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
[0-0]  Error:  Test failed due to following error(s):
  - BaseSnapExecutor.test.browser.ts: Failed to fetch dynamically imported module: http://localhost:52887/src/common/test-utils/endowments.ts: TypeError: Failed to fetch dynamically imported module: http://localhost:52887/src/common/test-utils/endowments.ts

[0-0] FAILED in chrome - file:///src/common/BaseSnapExecutor.test.browser.ts
[0-1] RUNNING in chrome - file:///src/common/endowments/endowments.test.browser.ts
2024-07-15T20:52:56.046Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
[0-1]  Error:  Test failed due to following error(s):
  - endowments.test.browser.ts: Failed to fetch dynamically imported module: http://localhost:52917/src/common/test-utils/endowments.ts: TypeError: Failed to fetch dynamically imported module: http://localhost:52917/src/common/test-utils/endowments.ts

[0-1] FAILED in chrome - file:///src/common/endowments/endowments.test.browser.ts
[0-2] RUNNING in chrome - file:///src/common/lockdown/lockdown-events.test.browser.ts
2024-07-15T20:52:58.874Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
 Hook executed: "before all" hook: wrappedHook in "{root}"
 ------------------------------------------------------------------
 Suite started: 
   » file:///src/common/lockdown/lockdown-events.test.browser.ts
 lockdown events security
    ✓ should lockdown events and made event properties inaccessible » [ file:///src/common/lockdown/lockdown-events.test.browser.ts ]
 Hook executed: "after all" hook: wrappedHook in "{root}"
[0-2] PASSED in chrome - file:///src/common/lockdown/lockdown-events.test.browser.ts
[0-3] RUNNING in chrome - file:///src/iframe/IFrameSnapExecutor.test.browser.ts
2024-07-15T20:53:01.110Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
[0-3] Removing intrinsics.Number.isNaN.getPolyfill
[0-3] Removing intrinsics.Number.isNaN.implementation
[0-3] Removing intrinsics.Number.isNaN.shim
[0-3] MetaMask: Connected to chain with ID "0x1".
 Hook executed: "before all" hook: wrappedHook in "{root}"
 ------------------------------------------------------------------
 Suite started: 
   » file:///src/iframe/IFrameSnapExecutor.test.browser.ts
 IFrameSnapExecutor
 Hook executed: "before all" hook for IFrameSnapExecutor
    ✓ receives and processes commands » [ file:///src/iframe/IFrameSnapExecutor.test.browser.ts ]
 Hook executed: "after all" hook: wrappedHook in "{root}"
[0-3] PASSED in chrome - file:///src/iframe/IFrameSnapExecutor.test.browser.ts
[0-4] RUNNING in chrome - file:///src/proxy/ProxySnapExecutor.test.browser.ts
2024-07-15T20:53:04.866Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
 Hook executed: "before all" hook: wrappedHook in "{root}"
 ------------------------------------------------------------------
 Suite started: 
   » file:///src/proxy/ProxySnapExecutor.test.browser.ts
 ProxySnapExecutor
    ✓ forwards messages to the iframe » [ file:///src/proxy/ProxySnapExecutor.test.browser.ts ]
    ✓ terminates the iframe » [ file:///src/proxy/ProxySnapExecutor.test.browser.ts ]
 Hook executed: "after all" hook: wrappedHook in "{root}"
[0-4] PASSED in chrome - file:///src/proxy/ProxySnapExecutor.test.browser.ts
[0-5] RUNNING in chrome - file:///src/webworker/executor/WebWorkerSnapExecutor.test.browser.ts
2024-07-15T20:53:07.651Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
[0-5] Removing intrinsics.Number.isNaN.getPolyfill
[0-5] Removing intrinsics.Number.isNaN.implementation
[0-5] Removing intrinsics.Number.isNaN.shim
[0-5] MetaMask: Connected to chain with ID "0x1".
 Hook executed: "before all" hook: wrappedHook in "{root}"
 ------------------------------------------------------------------
 Suite started: 
   » file:///src/webworker/executor/WebWorkerSnapExecutor.test.browser.ts
 WebWorkerSnapExecutor
 Hook executed: "before all" hook for WebWorkerSnapExecutor
 Hook executed: "before each" hook for WebWorkerSnapExecutor
    ✓ receives and processes commands » [ file:///src/webworker/executor/WebWorkerSnapExecutor.test.browser.ts ]
    - handles closing the stream » [ file:///src/webworker/executor/WebWorkerSnapExecutor.test.browser.ts ]
    - handles stream errors » [ file:///src/webworker/executor/WebWorkerSnapExecutor.test.browser.ts ]
 Hook executed: "after all" hook: wrappedHook in "{root}"
[0-5] PASSED in chrome - file:///src/webworker/executor/WebWorkerSnapExecutor.test.browser.ts
[0-6] RUNNING in chrome - file:///src/webworker/pool/WebWorkerPool.test.browser.ts
2024-07-15T20:53:10.854Z ERROR @wdio/browser-runner:plugin: No environment found for non determined environment
[0-6] [Worker] Error initializing job: Error: Failed to fetch.
 Hook executed: "before all" hook: wrappedHook in "{root}"
 ------------------------------------------------------------------
 Suite started: 
   » file:///src/webworker/pool/WebWorkerPool.test.browser.ts
 WebWorkerPool
    ✓ forwards messages to the worker » [ file:///src/webworker/pool/WebWorkerPool.test.browser.ts ]
    ✓ terminates the worker » [ file:///src/webworker/pool/WebWorkerPool.test.browser.ts ]
    ✓ creates a worker pool » [ file:///src/webworker/pool/WebWorkerPool.test.browser.ts ]
    ✓ handles errors » [ file:///src/webworker/pool/WebWorkerPool.test.browser.ts ]
 Hook executed: "after all" hook: wrappedHook in "{root}"
[0-6] PASSED in chrome - file:///src/webworker/pool/WebWorkerPool.test.browser.ts

 "spec" Reporter:
------------------------------------------------------------------
Running: chrome-headless-shell (v126.0.6478.127) on mac
Session ID: 193c5b071316ff7ab9bf1b33a4dbe201

» file:///src/common/lockdown/lockdown-events.test.browser.ts
lockdown events security
   ✓ should lockdown events and made event properties inaccessible

1 passing (444ms)
------------------------------------------------------------------
Running: chrome-headless-shell (v126.0.6478.127) on mac
Session ID: ec22bb9107726745900b327cb7a14d37

» file:///src/iframe/IFrameSnapExecutor.test.browser.ts
IFrameSnapExecutor
   ✓ receives and processes commands

1 passing (1.8s)
------------------------------------------------------------------
Running: chrome-headless-shell (v126.0.6478.127) on mac
Session ID: e0c43d2eff8a5c3576fd4f7d3adcd274

» file:///src/proxy/ProxySnapExecutor.test.browser.ts
ProxySnapExecutor
   ✓ forwards messages to the iframe
   ✓ terminates the iframe

2 passing (953ms)
------------------------------------------------------------------
Running: chrome-headless-shell (v126.0.6478.127) on mac
Session ID: 63c2feb62ae19c285652f1ef4a267c65

» file:///src/webworker/executor/WebWorkerSnapExecutor.test.browser.ts
WebWorkerSnapExecutor
   ✓ receives and processes commands
   - handles closing the stream
   - handles stream errors

1 passing (1s)
2 skipped
------------------------------------------------------------------
Running: chrome-headless-shell (v126.0.6478.127) on mac
Session ID: 2bf2771f5c6d1f849b721d754095f564

» file:///src/webworker/pool/WebWorkerPool.test.browser.ts
WebWorkerPool
   ✓ forwards messages to the worker
   ✓ terminates the worker
   ✓ creates a worker pool
   ✓ handles errors

4 passing (854ms)

Spec Files:      5 passed, 2 failed, 7 total (100% completed) in 00:00:26 undefined 
Mrtenz commented 2 months ago

Fixed in #2598.