'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
var createScriptElement = exports.createScriptElement = function createScriptElement(_ref) {
  var _ref$scriptCode = _ref.scriptCode,
      scriptCode = _ref$scriptCode === undefined ? '' : _ref$scriptCode,
      scriptUrl = _ref.scriptUrl;

  var script = document.createElement('script');
  script.type = 'text/javascript';
  if (scriptUrl) {
    script.src = scriptUrl;
  } else {
    script.text = scriptCode;
  }
  return script;
};

// need to call "mocha.run()" at the end of the spec
var createMochaScript = exports.createMochaScript = function createMochaScript(testSpecCode) {
  return createScriptElement(testSpecCode + '\nmocha.run();');
};