Skip to content

Fix test runs that hang, misplace errors or pass with no tests - #29

Merged
bbatsov merged 5 commits into
mainfrom
tests-polish
Oct 20, 2026
Merged

bbatsov merged 5 commits into
mainfrom
tests-polish

Conversation

@bbatsov

@bbatsov bbatsov commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

A whole-project neorepl test with cider-nrepl waited forever when a project namespace didn't load: orchard's namespace query throws an NPE that never reaches a done. neorepl now loads the project's namespaces itself first, through orchard, and says which ones don't load. The real fix belongs in cider-nrepl, and it's noted in PLAN.md's open questions.

The other commits place test errors at the test rather than in Numbers.java, give a run a single timeout that covers loading the tests, fail a run of a namespace that has no tests, and show failure paths relative to the project.

cider-nrepl's test-var-query, asked to load the project's namespaces,
never answers when one of them doesn't load: orchard's namespace query
throws a NullPointerException, which gets past the op without a done. So
neorepl test, or the MCP test tool, without names waited for good. With
cider-nrepl, neorepl now loads the project's namespaces itself first, the
ones orchard finds, in a copy of the session, says which don't load and
why, and has test-var-query run the loaded ones.

A namespace that threw while loading is gone, but loaded as far as require
goes, its ns form having said so, so a second run quietly left it out. Both
that load and the one of the namespaces named now reload such a namespace,
which says why again, and the latter's error says which namespaces it was
loading, rather than that the server couldn't do eval.
cider-nrepl gives a test error the file of the frame that threw, and the
test's line, so ERROR in demo.core-test/erroring-test (Numbers.java:9)
pointed nowhere. babashka gives every failure whichever file the session
loaded last, so after neorepl load they all pointed at that. From the test
ops, errors now take their test's file, and on babashka every failure
does. clojure.test's own report, without the test ops, has an error's
file and line from the same frame, so it stays as it is.
--timeout applied to each step of a run on its own, the loading of the
tests, the run and the stack traces of its errors, so a run could take
several times as long, and a timeout while loading the tests came out as a
connection problem, exit 3. One deadline now covers it all, evaluate taking
it as :deadline, and running out while loading says so and exits 124. The
stack traces get a second at least, so a run that ends near the deadline
still has them.
neorepl test of a namespace without tests, like the namespace under test
rather than its tests', printed No tests ran and exited 0, which reads as
everything passing. It now says there are no tests in it and exits 1,
unless a fixture failed before any test ran, which reports that instead.
The headings of test failures had absolute paths, long enough to wrap,
for files that are in the project neorepl runs in. They're relative to
that directory now, as editors and compilers write them, in text output
only.
@bbatsov
bbatsov merged commit dcdd7b6 into main Oct 20, 2026
18 checks passed
@bbatsov
bbatsov deleted the tests-polish branch October 20, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant