The JavaScript testing framework your high school chemistry teacher would be proud of.

Usage no npm install needed!

<script type="module">
  import aftHeisenberg from 'https://cdn.skypack.dev/@aft/heisenberg';



The JavaScript testing framework your high school chemistry teacher would be proud of.

Build Status Codacy Badge Dependency Status

❗️❗️ Still being built. Not yet ready for legit use. ❗️❗️

To quickly see a sample project use yarn test, or look in /dev/ for the source

NOTE: I created this framework to test a specific piece of software at work. Therefore, YMMV (severely). Also, I have only tested this using pretty simple JS web based apps. Nothing fancy yet.

The state of JavaScript testing is pretty miserable. I created this framework so that I could have complete control over my testing, but still leverage the convenience of other frameworks and tools like TAP, Sinon, and JSDom.

I'm sure the code is pretty inefficient right now, and I hope to put some time into really optimizing it soon; however, here is what I think makes it stand out from the rest from the get-go.

  • The test format is much sexier (and more straightforward) than other JS frameworks. Here's what a test looks like:
  name: "Automatic fixture loading and automatically scoped DOM",
  test: () => {
    $0.equal($("#myDiv").html(), "My div says this text");
  • It's modular and customizable! Custom specs (in progress) for easy, mass test configuration. Each file of tests runs inside its own browser sandbox. This means that each test file, effectively, has its own DOM, localStorage, etc.
  • Vanilla JS source file functions are automatically exported. This means you can test your browser JS code in this nodeJS testing framework without having to manually write module.exports for every function you want to test! This is HIGHLY experimental. Has worked for the few files I have thrown at it. Would love your pull requests! ;)
  • Out of the box fixture support and localStorage support (and it's automatically provided to your test's global scope, meaning your code should work out of the box)
  • Built in coverage support with NYC
  • Easy dependency support. Adding jQuery to a test is as easy as adding a reference to it in the test object. See "/dev/tests/externalSources.js" for an example.

I am working on the following:

  • Mocks and stubs with Sinon
  • Performance to rival Ava
  • Packaging for web (minify, webpack, obfuscate??, etc.)
  • Automatic web browser support change notifications. For example, if your code stops supporting a certain browser, Heisenberg will tell you.
  • Among other things (checkout CHANGELOG.md for my todo list)

If you're awesome, report bugs and make pull requests!


Make sure you have Yarn installed, and then add Heisenberg to your project using yarn add @aft/heisenberg Add the following line to your package.json:

"scripts": { "cook": "cook" }

To run the tests under "./tests/" use yarn run cook


This is also a good way to see a quick demo of the framework in action.

I've implemented a few tests for Heisenberg as a self-check. This is what the Travis-CI build uses. To run the self tests, clone the repo, and then run yarn test