<commit_before>expect = require("chai").expect
sinon = require("sinon")

Reporter = require("../../src/reporters/xhr_reporter")

oldXhr = null
MockXhr = ->
MockXhr.prototype = {
  open: ->
  send: ->
  setRequestHeader: ->
}

describe "XHRReporter", ->
  beforeEach ->
    oldXhr = global.XMLHttpRequest
    global.XMLHttpRequest = MockXhr
  afterEach ->
    global.XMLHttpRequest = oldXhr
<commit_msg>Localize oldXhr var<commit_after>expect = require("chai").expect
sinon = require("sinon")

Reporter = require("../../src/reporters/xhr_reporter")

MockXhr = ->
MockXhr.prototype = {
  open: ->
  send: ->
  setRequestHeader: ->
}

describe "XHRReporter", ->
  oldXhr = null
  beforeEach ->
    oldXhr = global.XMLHttpRequest
    global.XMLHttpRequest = MockXhr
  afterEach ->
    global.XMLHttpRequest = oldXhr

{'fraction_non_alphanumeric': 0.14532019704433496, 'fraction_numerical': 0.0, 'mean_word_length': 3.593220338983051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '6801830', 'n_tokens_mistral': 287, 'n_tokens_neox': 282, 'n_words': 48}