before(async () => { await runscript(`tsc -p ${baseDir}/tsconfig.json`, { cwd: baseDir }); const dest = path.join(baseDir, 'node_modules/egg'); await rimraf(dest); await mkdirp(path.dirname(dest)); fs.symlinkSync('../../../../../', dest); });
agent.beforeStart(async () => { const rundir = agent.config.rundir; const files = await fs.readdir(rundir); for (const file of files) { if (!/^(agent|application)_timing/.test(file)) continue; await rimraf(path.join(agent.config.rundir, file)); } });
before(function* () { yield rimraf(localOffsetStoreDir); consumer = new Consumer(Object.assign({ httpclient, isBroadcast: true, rebalanceInterval: 2000, pullThresholdForQueue: 1, consumeFromWhere: 'CONSUME_FROM_FIRST_OFFSET', pullTimeDelayMillsWhenFlowControl: 5000, }, config)); producer = new Producer(Object.assign({ httpclient, }, config)); yield [ consumer.ready(), producer.ready(), ]; });
const HAS_CONSUMED = Symbol('Context#multipartHasConsumed'); module.exports = { /** * clean up request tmp files helper * @method Context#cleanupRequestFiles * @param {Array<String>} [files] - file paths need to clenup, default is `ctx.request.files`. */ async cleanupRequestFiles(files) { if (!files || !files.length) { files = this.request.files; } if (Array.isArray(files)) { for (const file of files) { try { await rimraf(file.filepath); } catch (err) { // warning log this.coreLogger.warn('[egg-multipart-cleanupRequestFiles-error] file: %j, error: %s', file, err); } } } }, /** * create multipart.parts instance, to get separated files. * @method Context#multipart * @param {Object} [options] - override default multipart configurations * - {Boolean} options.autoFields * - {String} options.defCharset
afterEach(function* () { mm.restore(); yield rimraf(tmp); helper.restore(); });
beforeEach(() => rimraf(tmp));
before(function* () { yield rimraf(tmp); command = new Command(); helper = new Helper(command); });
before(() => { return rimraf(localOffsetStoreDir); });