<commit_before>'use strict';

var express = require('express');
var request = require('supertest');
var mongoose = require('mongoose');
var events = require('events');
var Q = require('q');
var assert = require('assert');

module.exports = function(app, server, settings, mount, config) {
  // Track the status of the initial test bootstrap.
  var bootstrap = Q.defer();

  // Use the given express app or default;
  app = app || express();

  // Use the given router or default to the formio server.
  config = config || require('./config.json');
  var formioServer = server || require('../index')(config);

  // Initialize the formio router.
  formioServer.init(settings).then(function(_formio) {
    // Allow tests access to formio.
    app.formio = _formio;

    // Use the formio router and optional mounting point.
    if (mount) {
      app.use(mount, formioServer);
    } else {
      app.use(formioServer);
    }

    // Say we are ready.
    bootstrap.resolve({
      app: app,
      template: template<commit_msg>Adding formio server internals for test suite, removing unused pkg.<commit_after>'use strict';

var express = require('express');
var request = require('supertest');
var mongoose = require('mongoose');
var events = require('events');
var Q = require('q');

module.exports = function(app, server, settings, mount, config) {
  // Track the status of the initial test bootstrap.
  var bootstrap = Q.defer();

  // Use the given express app or default;
  app = app || express();

  // Use the given router or default to the formio server.
  config = config || require('./config.json');
  var formioServer = server || require('../index')(config);

  // Initialize the formio router.
  formioServer.init(settings).then(function(_formio) {
    // Allow tests access to formio.
    app.formio = _formio;

    // Expose server internals.
    app._server = formioServer;

    // Use the formio router and optional mounting point.
    if (mount) {
      app.use(mount, formioServer);
    } else {
      app.use(formioServer);
    }

    // Say we are ready.
    bootstrap.resolve({
      app: app,
      template: template
{'fraction_non_alphanumeric': 0.13114754098360656, 'fraction_numerical': 0.0, 'mean_word_length': 3.1964636542239684, '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': '6391878', 'n_tokens_mistral': 623, 'n_tokens_neox': 605, 'n_words': 208}