title: Ajax-driven JavaScript runtime assertion framework
body: <p>While working on a larger web application with an increasing amount of JavaScript code, we did a brainstorming session on how to improve code quality.</p>
  
  <p>One of the first ideas was to introduce unit tests. This will be a long term goal; that will not, however, fix the most common causes of regression: the changing DOM and browser specific issues.</p>
  
  <p>Unit tests run in a mocked, DOM-less environment and are not on the page.</p>
  
  <p>What I'm looking for is an assertion framework that can be plugged into the code like this:</p>
  
  <pre><code>var $div = $("div.fooBarClass");
  assertNotEmpty($div);
  $div.fooBarAction();
  </code></pre>
  
  <p>I've found assertion frameworks that can do this, but they all either log into the console or into the DOM or open a silly pop-up. None of these work together with (thousands of) automated tests.
  <strong>What I'm looking for is a run-time assertion framework that logs failed assertion via AJAX!</strong> Ideally, it should be:</p>
  
  <ul>
  <li>Have common assertions built-in.</li>
  <li>Integrate with JQuery modules, closures.</li>
  <li>Log (via Ajax) the assertion, the file name, the page, <a href="https://stackoverflow.com/questions/1340872/how-to-get-javascript-caller-function-line-number-how-to-get-javascript-caller-s">line number</a>, the cause of failure, some pre-configured variables of the environment (browser, release version etc.).</li>
  <li><strong>Support callbacks in case of failures. (If any assertion framework can just do this, I would be gladly willing to write callbacks doing the Ajax part.)</strong></li>
  <li>Work well with all browsers.</li>
  <li>Trivial to exclude from production release.</li>
  <li>Maintained code base.</li>
  </ul>