diff --git a/packages/toolkit/src/test/srcShared/fs.test.ts b/packages/toolkit/src/test/srcShared/fs.test.ts index c15ba79165f..7d3a6ccefdc 100644 --- a/packages/toolkit/src/test/srcShared/fs.test.ts +++ b/packages/toolkit/src/test/srcShared/fs.test.ts @@ -13,6 +13,7 @@ import * as os from 'os' import { isMinimumVersion } from '../../shared/vscode/env' import Sinon from 'sinon' import * as extensionUtilities from '../../shared/extensionUtilities' +import crypto from 'crypto' function isWin() { return os.platform() === 'win32' @@ -174,7 +175,7 @@ describe('FileSystem', function () { await fsCommon.mkdir(dirPath) assert.ok(existsSync(dirPath)) - assert.ok(mkdirSpy.calledOnce) + assert.strictEqual(mkdirSpy.callCount, 1) }) }) }) @@ -299,8 +300,11 @@ describe('FileSystem', function () { return path.join(testRootPath(), relativePath) } + let _testRootPath: string | undefined + function testRootPath() { - return path.join(fakeContext.globalStorageUri.fsPath, 'testDir') + _testRootPath ??= path.join(fakeContext.globalStorageUri.fsPath, crypto.randomBytes(4).toString('hex')) + return _testRootPath } async function makeTestRoot() { @@ -308,6 +312,7 @@ describe('FileSystem', function () { } async function deleteTestRoot() { - return rmSync(testRootPath(), { recursive: true }) + rmSync(testRootPath(), { recursive: true }) + _testRootPath = undefined } })