1
0
forked from rosa/hakurei

12 Commits

Author SHA1 Message Date
kat
2e1f2bd93c TODO: docs 2026-05-16 16:57:06 +10:00
kat
bd14ea200f TODO: consider writing tests for the test runner. 2026-05-16 16:57:06 +10:00
kat
916dc28c4a TODO: actually write tests lol. 2026-05-16 16:57:06 +10:00
kat
af0f55760d TODO: auto-load test files based on name, just like go (see long desc)
squash this into the commit that first added all_tests.ts, we don't even
want to have a trace of it left

for the cli ones, we can simply iterate the filesystem relative our
location. for the web one, we determine it on launch and expose it as an
endpoint from the server which the client queries
2026-05-16 16:57:06 +10:00
kat
2379207fb9 TODO: limited selective execution from cli (see long desc)
well the problem with arbitrary selection is that... you need to do lots
of matching, which is confusing too when you need to encode nesting. so
what if just.. node cli.js index_test.js?

this isn't concerned with reporters or execution, this happens at the
cli level and it solely affects which modules are imported instead of
just all_tests.js.

alternatively, we could do suites instead of files. this is probably
better huh because you don't need to type out all those file paths, and
it doesn't punish large files (because a test file corresponds to
a source code file)

so we'd just import all_tests.js, then just filter out suites whose name
doesn't match <input>, before calling `run` on it. deleting and
filtering out suites should probably be methods on the registrar

i suspect the impl will be tiny excl argument parser nonsense, so imo
squash this into the commit that added registrars

add a comment describing the use-case as “just run the tests i'm editing
to save time”, rather than as skipping, then briefly mention why general
purpose skipping is still a tentative future feature
2026-05-16 16:57:06 +10:00
kat
5703c17d4f TODO: display elapsed time (see long description)
both on a test level and for the whole thing. i think the reporter or
registrar abstractions should deal with all timeouts, and just feed
elapsed time through all the functions: update() gets time for the
specific test, and finalize passes you the total time. this way you
don't need to do the same logic in every reporter, and you also give
a suggestion to reporter writers (i.e.: you in the future) to expose
test durations. actually tbh per-test isn't possible anywhere but in the
executor, especially when taking potential future parallel execution
into account

on the topic of parallelism: per-test is wall clock for that test,
regardless of perceived time, because no other number is useful. whole
thing is wall clock too, not cpu time

remember:
  - use monotonic clocks!! we need elapsed time, not absolute time
  - format them to more readable strings like “15h 12m” instead of
    “54738 seconds”. once things get large we can be less precise

for the go reporter: ask ozy if the go one already measures it. if so
then don't even bother serializing it

for the stream reporter: the live feed should include per-test time in
brackets or something. the final tree should only include timeout for
outliers on the long side (just shove a box plot-esque algo on it), and
if a flag is given print it for all nodes, and if another flag is given
print the n longest tests. the total time should be in the summary line
at the end in brackets à la pytest

for the dom reporter, we do the same as with the stream reporter's
outlier detection, and have a checkbox or button to dynamically
show/hide all timeouts, and another button to toggle a widget of sorts
that shows up right above the result tree which includes the n longest
tests. all these buttons should be on the same line as the summary
(successes/failures/skips). the total time should be included in the
“execution finished” text form the previous commit, i.e. “execution
finished in 15s”
2026-05-16 16:57:06 +10:00
kat
b5357ef274 TODO: display text execution progress (see long description)
since the test tree is statically known, we also statically know how
many tests are present. we should hence be using this to provide
a counter, say [1/48], to give a rough estimate as to when tests might
finish. not a time estimate of course, since we can't determine that

nota bene, we can't pass the current test count, and instead need to let
the reporter deal with that, since otherwise we can't easily parallelize
execution in the future. definitely mention this in a comment somewhere
to elaborate on the design

for the go reporter, ask ozy if go has any way to tell it this info.
i doubt it since they don't have a statically known test count. if it
does, then just send the count alongside the tree

for the stream reporter, ignore it entirely; we don't even display
successes by default so the number has nowhere to be attached to

for the dom reporter, put it somewhere in the header, i think alongside
the success/failure/skip count. something like “in progress (4/28)”.
then once finalize() is called change the whole thing to “execution
finished”
2026-05-16 16:57:06 +10:00
kat
f1ab20b099 cmd/mbf: jstest: implement skipping from within the DSL 2026-05-16 16:57:06 +10:00
kat
8c08d9401c cmd/mbf: jstest: add JSON reporter for go test integration 2026-05-16 16:57:06 +10:00
kat
abecc481d1 cmd/mbf: jstest: implement DSL and runner 2026-05-16 16:57:06 +10:00
kat
908d86466e cmd/mbf: jstest: add DOM reporter 2026-05-16 16:57:06 +10:00
kat
f664c50a7c cmd/mbf: jstest: add basic CLI reporter 2026-05-16 16:57:06 +10:00

View File

@@ -249,11 +249,12 @@ export class StreamReporter implements Reporter {
case "success":
this.#successes.push({ path, ...result });
// NOTE: emojis are used instead of colored Unicode symbols as
// coloring isn't possible through all streams and there detecting
// if colors should be used is very difficult¹. Furthermore,
// ensuring reasonable contrast is retained on every possible theme
// is difficult, with reverse video often being the only way, and
// the Unicode characters might be too small to be immediately
// coloring isn't possible through all streams and detecting if
// colors should be used is very difficult¹. Furthermore, ensuring
// reasonable contrast is retained on every possible theme is
// difficult, with reverse video often being the only way (which
// also has questionable support across terminal emulators), and the
// Unicode characters might be too small to be immediately
// noticeable. Emojis have an upper hand in that they're more common
// than obscure Unicode characters—which also means you're more
// likely to have an emoji font but not a font with those
@@ -264,7 +265,7 @@ export class StreamReporter implements Reporter {
// https://no-color.org, https://bixense.com/clicolors, and
// https://force-color.org, checking if setting the
// ENABLE_VIRTUAL_TERMINAL_PROCESSING bit on the TTY works when on
// on Windows, and doing something similar for Cygwin
// on Windows, and doing something similar for Cygwin.
if (this.verbose) this.stream.writeln(`✅️ ${pathStr}`);
break;
case "failure":