<commit_before>'use strict';

// Temporary fix until old LoDash is updated in some Gulp dependency
Object.getPrototypeOf.toString = function() {
  return 'function getPrototypeOf() { [native code] }';
};

require('rump-static');
var assert = require('assert');
var chalk = require('chalk');
var co = require('co');
var fetch = require('node-fetch');
var fs = require('mz/fs');
var gulp = require('gulp');
var sinon = require('sinon');
var sleep = require('timeout-then');
var rump = require('../lib');

describe('rump images tasks', function() {
  beforeEach(function() {
    rump.configure({
      paths: {
        source: {
          root: 'test/src',
          static: ''
        },
        destination: {
          root: 'tmp'
        }
      }
    });
  });

  it('are added and defined', function() {
    this.timeout(20000);
    var callback = sinon.spy();
    rump.on('gulp:main', callback);
    rump.on('gulp:server', callback);
    rump.addGulpTasks({prefix: 'spec'});
    // TODO Remove no callback check on next major core update
    assert(!callback.called || callback.calledTwice);
    assert(gulp.tasks['spec:info:server']);
    assert(gulp.tasks['spec:server']);
    assert(gulp.tasks['spec:server:prod']);
  });

  it('display correct information in info task', function() {
    var oldLog = console.log;
    var logs = [];
    console.log = function() {
      logs.push(chalk.stripColor(Array.from(arguments).join(' ')));
    };
    gulp.start('spec:info');
    console.log = oldLog;
    assert(logs.some(hasPaths));
    assert(logs.some(hasPort));
  });

  describe('for serving', function() {
    var original;<commit_msg>Drop excess timeout<commit_after>'use strict';

// Temporary fix until old LoDash is updated in some Gulp dependency
Object.getPrototypeOf.toString = function() {
  return 'function getPrototypeOf() { [native code] }';
};

require('rump-static');
var assert = require('assert');
var chalk = require('chalk');
var co = require('co');
var fetch = require('node-fetch');
var fs = require('mz/fs');
var gulp = require('gulp');
var sinon = require('sinon');
var sleep = require('timeout-then');
var rump = require('../lib');

describe('rump images tasks', function() {
  beforeEach(function() {
    rump.configure({
      paths: {
        source: {
          root: 'test/src',
          static: ''
        },
        destination: {
          root: 'tmp'
        }
      }
    });
  });

  it('are added and defined', function() {
    var callback = sinon.spy();
    rump.on('gulp:main', callback);
    rump.on('gulp:server', callback);
    rump.addGulpTasks({prefix: 'spec'});
    // TODO Remove no callback check on next major core update
    assert(!callback.called || callback.calledTwice);
    assert(gulp.tasks['spec:info:server']);
    assert(gulp.tasks['spec:server']);
    assert(gulp.tasks['spec:server:prod']);
  });

  it('display correct information in info task', function() {
    var oldLog = console.log;
    var logs = [];
    console.log = function() {
      logs.push(chalk.stripColor(Array.from(arguments).join(' ')));
    };
    gulp.start('spec:info');
    console.log = oldLog;
    assert(logs.some(hasPaths));
    assert(logs.some(hasPort));
  });

  describe('for serving', function() {
    var original;
{'fraction_non_alphanumeric': 0.17274119448698316, 'fraction_numerical': 0.0015313935681470138, 'mean_word_length': 3.3258278145695366, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2428282', 'n_tokens_mistral': 1017, 'n_tokens_neox': 1006, 'n_words': 234}