
// This file boots up Jasmine
//
import '6to5/polyfill'
import 'jasmine/jasmine.js'

var jasmineRequire = window.jasmineRequire = getJasmineRequireObj()
var jasmine = window.jasmine = jasmineRequire.core(jasmineRequire)
jasmineRequire.core(jasmineRequire)

var env = jasmine.getEnv()
var jasmineInterface = jasmineRequire.interface(jasmine, env)
Object.assign(window, jasmineInterface)

// Import the query string parser.
//
var queryString = new jasmine.QueryString({
  getWindowLocation() { return window.location }
})

// Report as pretty HTML
//
import 'jasmine/jasmine-html'
import 'jasmine/jasmine.css'
jasmineRequire.html(jasmine)
var htmlReporter = new jasmine.HtmlReporter({
  env: env,
  onRaiseExceptionsClick() {
    queryString.setParam('catch', !env.catchingExceptions())
  },
  getContainer() {
    return document.body
  },
  createElement() {
    return document.createElement.apply(document, arguments)
  },
  createTextNode() {
    return document.createTextNode.apply(document, arguments)
  },
  timer: new jasmine.Timer(),
})

// Catch exceptions based on queryString
//
var catchingExceptions = queryString.getParam('catch')
env.catchExceptions(
  typeof catchingExceptions === 'undefined' ?  true : catchingExceptions)

// Add those reporters!
//
env.addReporter(jasmineInterface.jsApiReporter)
env.addReporter(htmlReporter)
env.addReporter({
  jasmineDone() {
    setTimeout(function() {
      let specs = jsApiReporter.specs()
      let coverage = window.__coverage__ || null
      let json = JSON.stringify({ specs, coverage })
      let xh = new XMLHttpRequest()
      xh.open('POST', '/api/test', true)
      xh.setRequestHeader('Content-Type', 'application/json')
      xh.send(json)
    })
  }
})

var specFilter = new jasmine.HtmlSpecFilter({
  filterString() {
    return queryString.getParam('spec')
  }
})

env.specFilter = function(spec) {
  return specFilter.matches(spec.getFullName())
}

// Allow timing functions to be overridden.
// Certain browsers (Safari, IE 8, phantomjs) require this hack.
//
window.setTimeout = window.setTimeout
window.setInterval = window.setInterval
window.clearTimeout = window.clearTimeout
window.clearInterval = window.clearInterval

import 'val!./load.js'

htmlReporter.initialize()
env.execute()

@@ -381,16 +381,160 @@
 rface)%0A%0A
+// Import the HTML reporter and QueryString library%0A//%0Aimport 'jasmine/jasmine-html'%0Aimport 'jasmine/jasmine.css'%0AjasmineRequire.html(jasmine)%0A%0A
 // Impor
@@ -558,17 +558,16 @@
 g parser
-.
 %0A//%0Avar 
@@ -688,99 +688,11 @@
 TML%0A
+
 //%0A
-import 'jasmine/jasmine-html'%0Aimport 'jasmine/jasmine.css'%0AjasmineRequire.html(jasmine)%0A
 var 

fix test loading