You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(tests): use node:fs when globals are not initialized #5772
## Problem
In
https://github.com/aws/aws-toolkit-vscode/blob/16aa3684f479566bfcf6a9e33f88e70039831e9a/packages/core/src/test/globalSetup.test.ts#L48,
we use our fs.fs module which accesses globals.isWeb, but globals are not initialized yet.
```
Exception has occurred: Error: ToolkitGlobals accessed before initialize()
at Object.get (/Volumes/workplace/aws-toolkit-vscode/packages/core/src/shared/extensionGlobals.ts:109:23)
at FileSystem.get isWeb [as isWeb] (/Volumes/workplace/aws-toolkit-vscode/packages/core/src/shared/fs/fs.ts:689:24)
at FileSystem.mkdir (/Volumes/workplace/aws-toolkit-vscode/packages/core/src/shared/fs/fs.ts:94:63)
at Runner.<anonymous> (/Volumes/workplace/aws-toolkit-vscode/packages/core/src/test/globalSetup.test.ts:48:18)
```
To reproduce, go into master, run any test file individually with
"Extension Tests (current file) (amazonq)".
## Solution
Use node's fs when setting up tests since we must wait for global
context to be initialized to use our fs.
0 commit comments