export const createScriptElement = ({ scriptCode = '', scriptUrl }) => {
  const 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
export const createMochaScript = testSpecCode => createScriptElement(`${testSpecCode}\nmocha.run();`);
