JavaScript unit testing in the browser without Node.js: Getting Started | QUnit
Posted by jpluimers on 2026/01/29
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)
QUnit is open source at [Wayback/Archive] qunitjs/qunit: 🔮 An easy-to-use JavaScript unit testing framework.
Via:
- [Wayback/A] Alex Chan on Twitter: “I wrote about how I test my vanilla JS:
alexwlchan.net/2023/testing-javascript-without-a-frameworkRather than using a CLI or a test runner, I wrote a mini framework that runs in the browser, and displays results as rendered HTML output. It works everywhere and it looks pretty. 💪” / Twitter - [Wayback/Archive] Testing JavaScript without a (third-party) framework – alexwlchan
- [Wayback/Archive] 🔎Julia Evans🔍 (@b0rk) / Twitter
Related: [Wayback/Archive] Writing Javascript without a build system
Query: [Wayback/Archive] qunitjs – Google Search
–jeroen






Leave a comment