title: How to run mocha script to test url via browser (without using XMLHttpRequest)
body: <p>Hello: though new to nodejs and mocha and seek your help. Thank You in advance.</p>
  
  <p>I am trying to run a simple mocha test via the browser (not the terminal) to access a url and get the response status. </p>
  
  <p>Using <code>XMLHttpRequest</code> it works. However, i want to use a node library (say <a href="https://www.npmjs.com/package/request" rel="nofollow noreferrer">request.js</a>). For testing mocha script from browser i am unable to find how load request.js correctly. Please help.</p>
  
  <p><strong>test.js (using XMLHttpRequest)</strong></p>
  
  <pre><code>describe('suite', function(){
  
      it('case using XMLHTTPREQUEST', function(done){        
          var url = "http://oss.sheetjs.com/js-xlsx/test_files/formula_stress_test_ajax.xlsx";
          var xhr = new XMLHttpRequest();
          xhr.open("GET", url, true);
          xhr.onload = function (e) {
              console.log("TEST RESPONSE STATUS IS: " + xhr.status);
          }
          xhr.send();
          done();
      });
  
      it('case using AXIOS', function(done){        
          axios.get('http://www.google.com').then(
              function(response){
                      console.log(response.status);
                      done();
              });
      });
  });
  </code></pre>
  
  <p><strong>testrunner.html</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Mocha Tests&lt;/title&gt;
    &lt;link rel="stylesheet" href="../node_modules/mocha/mocha.css"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div id="mocha"&gt;&lt;/div&gt;
    &lt;script src="../node_modules/axios/dist/axios.js"&gt;&lt;/script&gt;
    &lt;script src="../node_modules/mocha/mocha.js"&gt;&lt;/script&gt;
    &lt;script&gt;mocha.setup('bdd')&lt;/script&gt;
    &lt;script src="./test.js"&gt;&lt;/script&gt;
    &lt;script&gt;
      mocha.run()
    &lt;/script&gt;
  &lt;/body&gt;    
  &lt;/html&gt;
  </code></pre>