<commit_before>if window?
  exports = window
  exports.IN_NODE = false
else
  exports = global
  exports.window = w = jsdom("<html><head><script></script></head><body></body></html>").createWindow()
  exports.document = w.document
  global.notStrictEqual = (actual, expected, message) -> ok expected != actual, message
  exports.IN_NODE = true

if exports.history?.pushState?
  originalLocation = window.location.href
  originalReset = QUnit.reset
  QUnit.reset = ->
    window.history.pushState({},'',originalLocation)
    originalReset.apply(this, arguments)

if exports.IN_NODE
  do ->
    hash = ''
    exports.window.location.__defineGetter__ 'hash', -> hash
    exports.window.location.__defineSetter__ 'hash', (value) ->
      hash = value
      evt = exports.window.document.createEvent "HTMLEvents"
      evt.initEvent "hashchange", true, false
      exports.window.dispatchEvent evt<commit_msg>better cleanup for tests<commit_after>if window?
  exports = window
  exports.IN_NODE = false
else
  exports = global
  exports.window = w = jsdom("<html><head><script></script></head><body></body></html>").createWindow()
  exports.document = w.document
  global.notStrictEqual = (actual, expected, message) -> ok expected != actual, message
  exports.IN_NODE = true


originalLocation = window.location.href
originalReset = QUnit.reset
QUnit.reset = ->
  if Batman.currentApp?
    Batman.currentApp.stop()
    Batman.currentApp = null
  window.location.hash = ""
  if window.history?.pushState? and window.location.href isnt originalLocation
    window.history.pushState(null, '', originalLocation)
  originalReset.apply(this, arguments)


if exports.IN_NODE
  do ->
    hash = ''
    exports.window.location.__defineGetter__ 'hash', -> hash
    exports.window.location.__defineSetter__ 'hash', (value) ->
      hash = value
      evt = exports.window.document.createEvent "HTMLEvents"
      evt.initEvent "hashchange", true, false
      exports.window.dispatchEvent evt
{'fraction_non_alphanumeric': 0.1270886075949367, 'fraction_numerical': 0.0, 'mean_word_length': 3.977329974811083, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '645551', 'n_tokens_mistral': 580, 'n_tokens_neox': 581, 'n_words': 123}