Fork me on GitHub
#nbb
<
2023-03-29
>
mkvlr19:03:38

just ported cognitect-labs/test-runner to nbb https://github.com/nextjournal/nbb-test-runner

🎉 12
mkvlr19:03:01

mk@mkair ~/d/nbb-test-runner (master)> yarn nbb -m nextjournal.test-runner --test-help
yarn run v1.22.19
$ /Users/mk/dev/nbb-test-runner/node_modules/.bin/nbb -m nextjournal.test-runner --test-help

USAGE:

clj -m nextjournal.test-runner <options>

  -d, --dir DIRNAME            Name of the directory containing tests. Defaults to "test".
  -n, --namespace SYMBOL       Symbol indicating a specific namespace to test.
  -r, --namespace-regex REGEX  Regex for namespaces to test.
  -v, --var SYMBOL             Symbol indicating the fully qualified name of a specific test.
  -i, --include KEYWORD        Run only tests that have this metadata keyword.
  -e, --exclude KEYWORD        Exclude tests with this metadata keyword.
  -H, --test-help              Display this help message

All options may be repeated multiple times for a logical OR effect.
If neither -n nor -r is supplied, use -r #".*-test$" (ns'es ending in '-test')
✨  Done in 0.23s.

cldwalker20:03:17

Nice! Look forward to trying this out. I have enough nbb tests that I'd love to swap in a test runner

mkvlr20:03:55

@U08ALHZ2N let me know how it goes for you

cldwalker20:03:35

Sure. Looks like it depends on the glob lib. One weakness of the current nbb.edn approach is all consumers of a nbb.edn have to add those npm libs locally. When I have time I could rewrite the glob/sync with native node libs if you'd like

mkvlr20:03:07

yeah, that would be nice, PR very welcome. I just pasted the code from the glob example in nbb.

👍 2
borkdude08:03:36

Maybe something like deps.cljs needs to be implemented for nbb as well

👍 2
cldwalker13:03:51

Mornin. Something like deps.cljs would be amazing

cldwalker15:03:36

@U5H74UNSF Afternoon. Replaced glob and fixed async issues with https://github.com/nextjournal/nbb-test-runner/pull/1

💯 4
mkvlr15:03:49

@U08ALHZ2N excellent, thank you!

mkvlr15:03:59

we don’t need /-main here, do we?

mkvlr15:03:04

yarn nbb -cp test -m nextjournal.test-runner

cldwalker15:03:34

Ah yep. Amended commit

mkvlr16:03:17

@cdlwalker merged, thank you!

cldwalker16:03:54

Great! If you'd ever need a CLI for the runner, happy to add one. Added one for nbb-logseq as described at https://github.com/logseq-cldwalker/nbb-test-runner/tree/add-cli#cli. It's handy for quickly running tests on small nbb-compatible, cljs repos with no deps

cldwalker16:03:42

For example, I was able to pull up to https://github.com/logseq/logseq/tree/master/deps/common which uses cljs-test-runner and was able to run the test suite instantly. So much better than waiting for cljs-test-runner or even its watch mode

geraldodev08:06:48

Thank you very much for nbb-test-runner

mkvlr08:06:37

@U0516053R thank you, glad to hear you find it useful