<commit_before>describe('Pipe', function () {
  'use strict';

  var common = require('./common')
    , Compiler = require('../lib/compiler')
    , http = require('http')
    , expect = common.expect
    , Pipe = common.Pipe
    , server
    , app;


  before(function (done) {
    server = http.createServer(function () {
      throw new Error('Unhandled request');
    });

    app = new Pipe(server, {
      pagelets: __dirname +'/fixtures/pagelets',
      dist: '/tmp/dist'
    }).listen(common.port, done);
  });

  it('exposes the Pagelet constructor', function () {
    expect(Pipe.Pagelet).to.be.a('function');
    expect(Pipe.Pagelet.extend).to.be.a('function');
  });

  it('is an EvenEmitter3', function () {
    expect(app).to.be.instanceOf(require('eventemitter3'));
  });

  it('correctly resolves `pagelets` as a string to an array', function () {
    expect(app._pagelets).to.be.a('array');
    expect(app._pagelets).to.have.length(4);
  });

  it('transforms pagelets', function () {
    var Pagelet = app._pagelets[0];

    expect(Pagelet.method).to.be.a('array');
  });

  it('has compiler for asset management', function () {
    expect(app).to.have.property('_compiler');
    expect(app._compiler).to.be.an('object');
    expect(app._compiler).to.be.instanceof(Compiler);
  });

  describe('private options', function () {
    it('has queryable options with defaults', function () {
      expect(app._options).to.be.a('function');
      expect(app._options('host')).to.equal(undefined);
      expect(app._options('host', 'localhost')).to.equal('localhost');

      var pipe = new Pipe(http.createServer(), {
          pagelets: __dirname +'/fixtures/pagelets'
        , dist: '/tmp/dist'
        , host: '127.0.0.1'
      });

      expect(pipe._options('host')).to.equal('127.0.0.1');
    });

    it('additional options can be merged, per example from a plugin', function () {
      expect(app._options.merge).to.be.a('function');
      expect(app._options('test')).to.equal(undefined);
<commit_msg>[test] middleware via supply<commit_after>describe('Pipe', function () {
  'use strict';

  var common = require('./common')
    , Compiler = require('../lib/compiler')
    , http = require('http')
    , expect = common.expect
    , Pipe = common.Pipe
    , server
    , app;


  before(function (done) {
    server = http.createServer(function () {
      throw new Error('Unhandled request');
    });

    app = new Pipe(server, {
      pagelets: __dirname +'/fixtures/pagelets',
      dist: '/tmp/dist'
    }).listen(common.port, done);
  });

  it('exposes the Pagelet constructor', function () {
    expect(Pipe.Pagelet).to.be.a('function');
    expect(Pipe.Pagelet.extend).to.be.a('function');
  });

  it('is an EvenEmitter3', function () {
    expect(app).to.be.instanceOf(require('eventemitter3'));
  });

  it('correctly resolves `pagelets` as a string to an array', function () {
    expect(app._pagelets).to.be.a('array');
    expect(app._pagelets).to.have.length(4);
  });

  it('transforms pagelets', function () {
    var Pagelet = app._pagelets[0];

    expect(Pagelet.method).to.be.a('array');
  });

  it('has supply middleware manager', function () {
    expect(app).to.have.property('middleware');
    expect(app.middleware).to.be.an('object');
    expect(app.middleware).to.be.instanceof(require('supply'));
  });

  it('has compiler for asset management', function () {
    expect(app).to.have.property('_compiler');
    expect(app._compiler).to.be.an('object');
    expect(app._compiler).to.be.instanceof(Compiler);
  });

  describe('private options', function () {
    it('has queryable options with defaults', function () {
      expect(app._options).to.be.a('function');
      expect(app._options('host')).to.equal(undefined);
      expect(app._options('host', 'localhost')).to.equal('localhost');

      var pipe = new Pipe(http.createServer(), {
          pagelets: __dirname +'/fixtures/pagelets'
        , dist: '/tmp/dist'
        , host: '127.0.0.1'
      });

      expect(pipe._options('host')).to.equal('127.0.0.1');
    });

    it('additional options can be merged, per example from a plugin', function () {
      expect(app._options.merge).to.be.a('function');
      expect(app._options('test')).to.equal(undefined);

{'fraction_non_alphanumeric': 0.18751461304652794, 'fraction_numerical': 0.007481879822305354, 'mean_word_length': 3.3255813953488373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '2801864', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1350, 'n_words': 237}