mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-19 16:55:02 +02:00
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Lorent Lempereur <lorent.lempereur@n8n.io>
24 lines
676 B
TypeScript
24 lines
676 B
TypeScript
import { mkdirSync, mkdtempSync, writeFileSync } from 'fs';
|
|
import { tmpdir } from 'os';
|
|
import { join } from 'path';
|
|
|
|
// Same instance setup as packages/cli/test/setup-test-folder.ts, so a moved test finds it.
|
|
process.env.N8N_ENCRYPTION_KEY = 'test_key';
|
|
|
|
const baseDir = join(tmpdir(), 'n8n-tests/');
|
|
mkdirSync(baseDir, { recursive: true });
|
|
|
|
const testDir = mkdtempSync(baseDir);
|
|
mkdirSync(join(testDir, '.n8n'));
|
|
process.env.N8N_USER_FOLDER = testDir;
|
|
process.env.N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS = 'true';
|
|
|
|
writeFileSync(
|
|
join(testDir, '.n8n/config'),
|
|
JSON.stringify({ encryptionKey: 'test_key', instanceId: '123' }),
|
|
{
|
|
encoding: 'utf-8',
|
|
mode: 0o600,
|
|
},
|
|
);
|