<commit_before>'use strict';

let path = require('path'),
  Engine = require('../lib/core/engine');

let BROWSERS = ['chrome', 'firefox'];

if (process.platform === 'win32') {
  BROWSERS.push('ie');
}

describe('Engine', function() {
  let engine;

  BROWSERS.forEach(function(browser) {

    describe('#run - ' + browser, function() {
      const scripts = {
        foo: '(function () {return "fff";})()',
        uri: 'document.documentURI',
        fourtytwo: '(function () {return 42;})()'
      };

      beforeEach(function() {
        engine = new Engine({
          'browser': browser,
          'iterations': 2,
          'delay': 17
        });
        return engine.start();
      });

      it('should be able to load a url', function() {
        // somewhat clunky way to ignore generated har data in test.
        let browsertimeData = engine.run('http://httpbin.org/html', {scripts})
          .then(function(r) {
            return r.browsertimeData;
          });
        return browsertimeData.should.become([
          {
            scripts: {
              'foo': 'fff',
              'uri': 'http://httpbin.org/html',
              'fourtytwo': 42
            }
          },
          {
            scripts: {
              'foo': 'fff',
              'uri': 'http://httpbin.org/html',
              'fourtytwo': 42<commit_msg>Test native hars instead of BMP hars.<commit_after>'use strict';

let path = require('path'),
  Engine = require('../lib/core/engine');

let BROWSERS = ['chrome', 'firefox'];

if (process.platform === 'win32') {
  BROWSERS.push('ie');
}

describe('Engine', function() {
  let engine;

  BROWSERS.forEach(function(browser) {

    describe('#run - ' + browser, function() {
      const scripts = {
        foo: '(function () {return "fff";})()',
        uri: 'document.documentURI',
        fourtytwo: '(function () {return 42;})()'
      };

      beforeEach(function() {
        engine = new Engine({
          'browser': browser,
          'iterations': 2,
          'delay': 17,
          'experimental.nativeHar': true
        });
        return engine.start();
      });

      it('should be able to load a url', function() {
        // somewhat clunky way to ignore generated har data in test.
        let browsertimeData = engine.run('http://httpbin.org/html', {scripts})
          .then(function(r) {
            return r.browsertimeData;
          });
        return browsertimeData.should.become([
          {
            scripts: {
              'foo': 'fff',
              'uri': 'http://httpbin.org/html',
              'fourtytwo': 42
            }
          },
          {
            scripts: {
              'foo': 'fff',
              'uri': 'http://httpbin.org/html',
              'fourtytwo': 42
{'fraction_non_alphanumeric': 0.16280752532561504, 'fraction_numerical': 0.007959479015918957, 'mean_word_length': 1.795753286147624, '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': '5283205', 'n_tokens_mistral': 835, 'n_tokens_neox': 798, 'n_words': 183}