htest.dev

0.0.12 • Public • Published

hTest

Declarative, boilerplate-free unit testing, for everyone.

https://htest.dev

What the hTest? Do we really need another unit testing framework?

hTest is a unit testing framework that focuses on making unit testing as quick and painless as possible. Forget copy-pasting 10 lines of boilerplate to write a single test. TDD is hard enough as it stands — the more friction in writing tests, the fewer are written. hTest aims to eliminate all boilerplate, so you can focus on the tests themselves.

hTest can be used in one of two ways: HTML-first or JS-first:

  • In JS-first mode you write your tests in nested object literals, and you can run them either in Node or in the browser. Tests inherit values they don’t specify from their parents, so you never have to repeat yourself.
    • More suitable for pure JS code.
    • Compatible with CI and other automated test running processes.
    • Code must be compatible with Node to use the Node test runner.
  • In HTML-first mode you write your tests in HTML files and run them only in the browser.
    • More suitable for UI-heavy code.
    • Pass-criteria extends beyond value matching or error catching, and could even be things like what CSS selectors match or what the DOM looks like.
    • Reactive evaluation: if the HTML changes or the user interacts with the UI, relevant tests are re-evaluated.
    • Mock interactions like click or focus with HTML attributes.

You can even mix and match the two modes in the same testsuite! E.g. even a UI-heavy library has many JS-only functions that are better tested via JS-first tests.

It is still a work in progress (soft launched), but stable enough to be used in production. The main things that still need to be done before launch are:

  • Fix CLI output glitches and improve usability (ideal would be an interactive tree that starts off collapsed)
  • Improve documentation
  • Ensure we're not missing essential things (setup/teardown?)

Sample terminal output

hTest in the wild

JS-first testsuites

HTML-first testsuites

Testsuites

Single page tests

Readme

Keywords

none

Package Sidebar

Install

npm i htest.dev

Homepage

htest.dev

Weekly Downloads

23

Version

0.0.12

License

MIT

Unpacked Size

621 kB

Total Files

43

Last publish

Collaborators

  • leaverou