<commit_before>var helper = {
  fillFixtureContainer : function (elem) {
    var fixtureContainer = document.getElementById('jasmine-fixtures')
    fixtureContainer.innerHTML = '';
    fixtureContainer.appendChild(elem);
  }
};

// exports for node.js
if (typeof exports === 'object') {
  var fs = require('fs');
  global.window = {};
  // provide some mocks for DOM-stuff
  global.document = {
    createElement : function (tag) {
      return {innerHTML : ''};
    },
    getElementById : function (id) {
      if (id === 'missing') return null;
      return global.document[id] = global.document[id] || {
        children : [],
        appendChild : function (elem) {this.children.push(elem);},
        innerHTML : '' 
      };
    }
  }
  global.navigator = {};

  global.hobbes = require('hobbes');

  global.helper = helper;
}

// beforeEach(function() {
//   this.addMatchers({
//     toBePlaying: function(expectedSong) {
//       var player = this.actual;
//       return player.currentlyPlayingSong === expectedSong
//           && player.isPlaying;
//     }
//   })
// });
<commit_msg>Refactor spec helper<commit_after>var helper = {
  fillFixtureContainer : function (elem) {
    var fixtureContainer = document.getElementById('jasmine-fixtures')
    fixtureContainer.innerHTML = '';
    fixtureContainer.appendChild(elem);
  }
};

// exports for node.js
if (typeof exports === 'object') {
  var fs = require('fs');

  global.helper = helper;
  
  mockBrowser();

  global.hobbes = require('hobbes');
}

function mockBrowser () {
  global.navigator = {};
  global.window = {};

  // DOM
  global.document = {
    createElement : function (tag) {
      return {innerHTML : ''};
    },
    getElementById : function (id) {
      // For behavior on missing element
      if (id === 'missing') return null;
      // Save mock element so that changes can be tracked
      return global.document[id] = global.document[id] || {
        children : [],
        appendChild : function (elem) {this.children.push(elem);},
        innerHTML : '' 
      };
    }
  }
}

// beforeEach(function() {
//   this.addMatchers({
//     toBePlaying: function(expectedSong) {
//       var player = this.actual;
//       return player.currentlyPlayingSong === expectedSong
//           && player.isPlaying;
//     }
//   })
// });

{'fraction_non_alphanumeric': 0.154376886589047, 'fraction_numerical': 0.0, 'mean_word_length': 2.6080870917573873, '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': '3685625', 'n_tokens_mistral': 700, 'n_tokens_neox': 666, 'n_words': 145}