mirror of
https://github.com/zoriya/flood.git
synced 2025-12-06 07:16:18 +00:00
20 lines
637 B
JavaScript
20 lines
637 B
JavaScript
import crypto from 'crypto';
|
|
import fs from 'fs';
|
|
import os from 'os';
|
|
import path from 'path';
|
|
|
|
const temporaryRuntimeDirectory = path.resolve(os.tmpdir(), `flood.test.${crypto.randomBytes(12).toString('hex')}`);
|
|
|
|
process.argv = ['node', 'flood'];
|
|
process.argv.push('--rundir', temporaryRuntimeDirectory);
|
|
process.argv.push('--auth', 'default');
|
|
process.argv.push('--assets', 'false');
|
|
|
|
afterAll(() => {
|
|
if (process.env.CI !== 'true') {
|
|
// TODO: This leads to test flakiness caused by ENOENT error
|
|
// NeDB provides no method to close database connection
|
|
fs.rmdirSync(temporaryRuntimeDirectory, {recursive: true});
|
|
}
|
|
});
|