Skip to content

Commit dd839fb

Browse files
committed
use node before globals init
1 parent edd90ca commit dd839fb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/core/src/test/globalSetup.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import { GlobalState } from '../shared/globalState'
2626
import { FeatureConfigProvider } from '../shared/featureConfig'
2727
import { mockFeatureConfigsData } from './fake/mockFeatureConfigData'
2828
import { fs } from '../shared'
29+
import { rm, mkdir } from 'fs/promises' //eslint-disable-line no-restricted-imports
2930

3031
disableAwsSdkWarning()
31-
3232
const testReportDir = join(__dirname, '../../../../../.test-reports') // Root project, not subproject
3333
const testLogOutput = join(testReportDir, 'testLog.log')
3434
const globalSandbox = sinon.createSandbox()
@@ -42,10 +42,11 @@ let openExternalStub: sinon.SinonStub<Parameters<(typeof vscode)['env']['openExt
4242
export async function mochaGlobalSetup(extensionId: string) {
4343
return async function (this: Mocha.Runner) {
4444
// Clean up and set up test logs
45+
// Use nodefs over our fs since globals may not be initialized yet and our fs checks isWeb via globals.
4546
try {
46-
await fs.delete(testLogOutput)
47+
await rm(testLogOutput)
4748
} catch (e) {}
48-
await fs.mkdir(testReportDir)
49+
await mkdir(testReportDir, { recursive: true })
4950

5051
sinon.stub(FeatureConfigProvider.prototype, 'listFeatureEvaluations').resolves({
5152
featureEvaluations: mockFeatureConfigsData,

0 commit comments

Comments
 (0)