title: How to test code that uses browsers APIs
body: <p>I'm using <strong>Node</strong> for running my <strong>unit-tests</strong>.</p>
  
  <p>I have a JavaScript module run in the browser I'd like to test.</p>
  
  <p>My code is "<strong>isomorphic</strong>", i.e. it avoids language features not available in Node, like <code>export</code>s.</p>
  
  <p>But it uses pure browsers APIs: <code>XMLHttpRequest</code>, <code>FormData</code> and <code>File</code>.<br>
  I have found Node's implementations for each of them.<br>
  But the one of <code>XMLHttpRequest</code> does not support <strong>upload</strong>.</p>
  
  <p>So I'm looking for the simplest way to unit-test this code in an environment with these APIs.<br>
  The code does not need DOM or other browsers APIs, "only" these three.  </p>
  
  <p>I've already used <strong>PhantomJS</strong> for other needs but:</p>
  
  <ul>
  <li>this will create another test workflow (minor issue),</li>
  <li>it supports an older JavaScript version and it would force a complete rewrite of the code to test (major issue),</li>
  <li>the code has a lot of NPM dependencies that probably won't be compatible (blocking issue).</li>
  </ul>
  
  <p>As the code is <strong>Browserified</strong> all these issues may disappear but before going along this way I'd like to be sure.</p>
  
  <p>Is there any chance to get it work with <strong>PhantomJS</strong>, <strong>CasperJS</strong> or the like?</p>
  
  <p>Which other alternatives are available?</p>