<commit_before>var test = require('tape');

test('index.browseAll() and an error occurs', function(t) {
  t.plan(2);

  var fauxJax = require('faux-jax');

  var bind = require('lodash-compat/function/bind');
  var createFixture = require('../../../../utils/create-fixture');
  var fixture = createFixture();
  var index = fixture.index;

  fauxJax.install();

  var browser = index.browseAll('some', {
    hitsPerPage: 200
  });

  fauxJax.once('request', browse);
  browser.once('error', error);
  browser.once('end', bind(t.fail, t));

  function browse(req) {
    req.respond(
      400,
      {},
      JSON.stringify({
        message: 'You are doomed'
      })
    );

    fauxJax.restore();
  }

  function error(err) {
    t.ok(err instanceof Error, 'We got an error');
    t.equal(<commit_msg>test: fix IE8 and IE9 test<commit_after>var test = require('tape');

test('index.browseAll() and an error occurs', function(t) {
  t.plan(2);

  var fauxJax = require('faux-jax');

  var bind = require('lodash-compat/function/bind');
  var createFixture = require('../../../../utils/create-fixture');
  var fixture = createFixture();
  var index = fixture.index;

  fauxJax.install();

  var browser = index.browseAll('some', {
    hitsPerPage: 200
  });

  fauxJax.once('request', browse);
  browser.once('error', error);
  browser.once('end', bind(t.fail, t));

  function browse(req) {
    req.respond(
      400,
      {},
      JSON.stringify({
        message: 'You are doomed',
        status: 400
      })
    );

    fauxJax.restore();
  }

  function error(err) {
    t.ok(err instanceof Error, 'We got an error');
    t.equal(
{'fraction_non_alphanumeric': 0.175, 'fraction_numerical': 0.011585365853658536, 'mean_word_length': 2.9447115384615383, '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': '4146204', 'n_tokens_mistral': 589, 'n_tokens_neox': 548, 'n_words': 122}