Comprehensive Unit Testing Strategies and Tools for JavaScript Applications

Table of Contents

Unit Tests

QUnit

Why not Jasmine, YUITest, etc.

Application setup

  • Stand-alone
  • YUITest
  • PhantomJS is universally required

Coverage

AST: Esprima

http://esprima.org/

   A JavaScript tokenizer / parser / beautifier / compressor.

   This version is suitable for Node.js.  With minimal changes (the
   exports stuff) it should work on any JS platform.

   This file contains the tokenizer/parser.  It is a port to JavaScript
   of parse-js [1], a JavaScript parser library written in Common Lisp
   by Marijn Haverbeke.  Thank you Marijn!

   [1] http://marijn.haverbeke.nl/parse-js/

Build: grunt-coverjs

https://github.com/jgrund/grunt-coverjs

   $ grunt instrumented
   if (typeof __$coverObject === "undefined"){
        if (typeof window !== "undefined") window.__$coverObject = {};
        else if (typeof global !== "undefined") global.__$coverObject = {};
        else throw new Error("cannot find the global scope");
   }

Author: Jason Walsh

j@wal.sh

Last Updated: 2024-10-30 16:43:54