A cool way to unit-test JavaScript code on the browser side is [Wayback/Archive] Getting Started | QUnit:
To get started with QUnit in the browser, create a simple HTML file called
test.htmland include the following markup:<!DOCTYPE html> <meta charset="utf-8"> <title>Test Suite</title> <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.19.4.css"> <body> <div id="qunit"></div> <div id="qunit-fixture"></div> <script src="https://code.jquery.com/qunit/qunit-2.19.4.js"></script> </body>That’s all the markup you need to start writing tests. Note that this loads the library from the jQuery CDN.
I was so glad to find QUnit via the below links as I unconsciously wanted such a thing for a very very long time.
You can either run it locally or remotely or from the jQuery CDN as both it
- is a Node.js module so the source files are all available on the jQuery CDN
- it does not require the Node.js to load so it can run from any location you want (that CDN, locally or another on-line location)





