Backport of 44930cc4667268c20493d7e97387db2a97d61a26 from master
Setup QUnit, added tests, and measured test coverage. Thanks to Nick Sanford for the initial tests.