My hobby programming project stalled
out. Again.
Because I still didn't want to npm install.
This time the issue was a test harness.
The project is a wannabe game engine. Or at least a wannabe animation
engine for now: user interaction is still in the works. I had gotten far enough
to be bothered by the ways the physics isn't working right.1 But the
code is growing in size, and fixing the physics code will be fiddly. That is,
after all, why it doesn't work right as things stand. Unit tests are part of my
process for handing that kind of fiddly.
And when you search for pure JavaScript unit testing frameworks, they all
request the forbidden incantation as step one. For the same perfectly valid
reasons tall the language server did, I'm sure.
Now, I've written testing frameworks of various kinds in the past. A set of
tests in Fortran for my dissertation analysis after the second attempt collapsed
under it's own weight; a really
kludgy mess of c-preprocessor and GNU-make just because I thought I was
clever,2 and a command-line end-to-end driver at work. None of them
are professional or polished but they all work in some sense, and that teaches
a lesson: it doesn't have to be fancy to work.
With that sort of thing in mind I conceived a vague notion of a minimal test
harness that would write its output into a webpage.3 Obviously I'm not
the first person to have that idea, and a little searching got
me an
example to use as inspiration. Thanks, Alex!
Only I couldn't leave well enough alone. I made it part of my "learn to
program with AI" effort, worked with Gemma4 to give it a fluent interface
despite my
misgivings about that whole idea and thus
was TestOf born. Maybe it'll be
useful for someone else.
1 Embarrassing for a physicist, I can assure you.
2 Please use something better than that!
3 We are talking JavaScript, after all.