diff options
| author | Tommaso Sciortino <[email protected]> | 2025-07-22 17:18:57 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-23 00:18:57 +0000 |
| commit | 30c68922a372755a5b9f918baf053e0d1f156fc5 (patch) | |
| tree | f2889f7f89fc3609071f943ce110a0d755d78b7f /packages/core/src/utils/getFolderStructure.test.ts | |
| parent | a00f1bb916b551fc17fa5bab80fb51dcdc88f00d (diff) | |
Fix windows bugs in atCommandProcessor.ts (#4684)
Diffstat (limited to 'packages/core/src/utils/getFolderStructure.test.ts')
| -rw-r--r-- | packages/core/src/utils/getFolderStructure.test.ts | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/packages/core/src/utils/getFolderStructure.test.ts b/packages/core/src/utils/getFolderStructure.test.ts index 8694fe20..3f1b4534 100644 --- a/packages/core/src/utils/getFolderStructure.test.ts +++ b/packages/core/src/utils/getFolderStructure.test.ts @@ -4,42 +4,37 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import fsPromises from 'fs/promises'; import * as nodePath from 'path'; import * as os from 'os'; import { getFolderStructure } from './getFolderStructure.js'; -import * as gitUtils from './gitUtils.js'; import { FileDiscoveryService } from '../services/fileDiscoveryService.js'; import * as path from 'path'; -vi.mock('./gitUtils.js'); - describe('getFolderStructure', () => { let testRootDir: string; - const createEmptyDir = async (...pathSegments: string[]) => { + async function createEmptyDir(...pathSegments: string[]) { const fullPath = path.join(testRootDir, ...pathSegments); await fsPromises.mkdir(fullPath, { recursive: true }); - }; + } - const createTestFile = async (...pathSegments: string[]) => { + async function createTestFile(...pathSegments: string[]) { const fullPath = path.join(testRootDir, ...pathSegments); await fsPromises.mkdir(path.dirname(fullPath), { recursive: true }); await fsPromises.writeFile(fullPath, ''); return fullPath; - }; + } beforeEach(async () => { testRootDir = await fsPromises.mkdtemp( path.join(os.tmpdir(), 'folder-structure-test-'), ); - vi.resetAllMocks(); }); afterEach(async () => { await fsPromises.rm(testRootDir, { recursive: true, force: true }); - vi.restoreAllMocks(); }); it('should return basic folder structure', async () => { @@ -246,8 +241,10 @@ ${testRootDir}${path.sep} }); describe('with gitignore', () => { - beforeEach(() => { - vi.mocked(gitUtils.isGitRepository).mockReturnValue(true); + beforeEach(async () => { + await fsPromises.mkdir(path.join(testRootDir, '.git'), { + recursive: true, + }); }); it('should ignore files and folders specified in .gitignore', async () => { |
