mirror of
https://github.com/n8n-io/n8n.git
synced 2026-12-05 01:00:52 +00:00
19 lines
670 B
TypeScript
19 lines
670 B
TypeScript
import { mkdtempSync, rmSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import { join } from 'node:path';
|
|
import { afterAll } from 'vitest';
|
|
|
|
// Keep tests away from the real ~/.config/rig, for example global secrets and profiles.
|
|
const root = mkdtempSync(join(tmpdir(), 'rig-home-'));
|
|
process.env.RIG_CONFIG_DIR = join(root, 'config');
|
|
process.env.RIG_DATA_DIR = join(root, 'data');
|
|
process.env.RIG_CACHE_DIR = join(root, 'cache');
|
|
// Never touch the OS keystore of the developer.
|
|
process.env.RIG_SECRETS_BACKEND = 'file';
|
|
delete process.env.RIG_LAUNCHER_PATH;
|
|
delete process.env.RIG_ENV;
|
|
|
|
afterAll(() => {
|
|
rmSync(root, { recursive: true, force: true });
|
|
});
|