Example #1
0
 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);
 });
Example #2
0
 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));
   }
 });
Example #3
0
 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(),
   ];
 });
Example #4
0
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
Example #5
0
 afterEach(function* () {
   mm.restore();
   yield rimraf(tmp);
   helper.restore();
 });
Example #6
0
 beforeEach(() => rimraf(tmp));
Example #7
0
 before(function* () {
   yield rimraf(tmp);
   command = new Command();
   helper = new Helper(command);
 });
Example #8
0
 before(() => {
   return rimraf(localOffsetStoreDir);
 });