Skip to content

Commit 198c371

Browse files
authored
tests: reset globalState after each test (#2729)
Helps keep state clean between tests Especially against any implementations that indirectly use `globalState`
1 parent 3626b1e commit 198c371

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/test/globalSetup.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { getLogger, LogLevel } from '../shared/logger'
1818
import { setLogger } from '../shared/logger/logger'
1919
import { CodelensRootRegistry } from '../shared/sam/codelensRootRegistry'
2020
import { activateExtension } from '../shared/utilities/vsCodeUtils'
21-
import { FakeExtensionContext } from './fakeExtensionContext'
21+
import { FakeExtensionContext, FakeMemento } from './fakeExtensionContext'
2222
import { TestLogger } from './testLogger'
2323
import * as testUtil from './testUtil'
2424

@@ -60,6 +60,7 @@ beforeEach(async function () {
6060
globals.telemetry.telemetryEnabled = true
6161
globals.telemetry.clearRecords()
6262
globals.telemetry.logger.clear()
63+
;(globals.context as FakeExtensionContext).globalState = new FakeMemento()
6364

6465
await testUtil.closeAllEditors()
6566
})

0 commit comments

Comments
 (0)