import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import path from 'node:path';
import { Storage } from '@hoptrendy/hopcode-core';
import { runWithAcpRuntimeOutputDir } from './runtimeOutputDirContext.js';
describe('runWithAcpRuntimeOutputDir', () => {
    beforeEach(() => {
        Storage.setRuntimeBaseDir(null);
        delete process.env['HOPCODE_RUNTIME_DIR'];
        delete process.env['QWEN_RUNTIME_DIR'];
    });
    afterEach(() => {
        Storage.setRuntimeBaseDir(null);
        delete process.env['HOPCODE_RUNTIME_DIR'];
        delete process.env['QWEN_RUNTIME_DIR'];
    });
    it('uses the merged runtimeOutputDir relative to cwd within the async context', async () => {
        const cwd = path.resolve('workspace', 'project-a');
        const settings = {
            merged: {
                advanced: {
                    runtimeOutputDir: '.hopcode-runtime',
                },
            },
        };
        await runWithAcpRuntimeOutputDir(settings, cwd, async () => {
            expect(Storage.getRuntimeBaseDir()).toBe(path.join(cwd, '.hopcode-runtime'));
        });
        expect(Storage.getRuntimeBaseDir()).toBe(Storage.getGlobalHopCodeDir());
    });
});
//# sourceMappingURL=runtimeOutputDirContext.test.js.map