diff --git a/src/test/srcShared/fs.test.ts b/src/test/srcShared/fs.test.ts index c15ba79165f..f137beb45fc 100644 --- a/src/test/srcShared/fs.test.ts +++ b/src/test/srcShared/fs.test.ts @@ -156,10 +156,15 @@ describe('FileSystem', function () { describe('mkdir()', function () { const paths = ['a', 'a/b', 'a/b/c', 'a/b/c/d/'] + let dirPath: string // store path for easy cleanup + + afterEach(async function () { + await fsCommon.delete(dirPath) + }) paths.forEach(async function (p) { it(`creates folder: '${p}'`, async function () { - const dirPath = createTestPath(p) + dirPath = createTestPath(p) await fsCommon.mkdir(dirPath) assert.ok(existsSync(dirPath)) }) @@ -169,12 +174,12 @@ describe('FileSystem', function () { it(`creates folder but uses the "fs" module if in C9: '${p}'`, async function () { sandbox.stub(extensionUtilities, 'isCloud9').returns(true) const mkdirSpy = sandbox.spy(fsPromises, 'mkdir') - const dirPath = createTestPath(p) + dirPath = createTestPath(p) await fsCommon.mkdir(dirPath) assert.ok(existsSync(dirPath)) - assert.ok(mkdirSpy.calledOnce) + assert.strictEqual(mkdirSpy.callCount, 1) }) }) })