kit-clj / kit-clj/kit

Test fixture does not reload system state when running tests interactively

Open
#148 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
558
Forks
56
PR merge metrics
No merged PRs in 30d

Description

I expected this workflow to work:
1. Run a test in my text editor (aka using REPL) using the fixture kit-clj generated `(use-fixtures :once (.test-utils/system-fixture))` - it fails
2. Change some api route config or code
3. Re-run the test and see behavior changed

Especially surprising to me because I was changing the code in the `:handler` but even that didn't get updated, because the built reitit API stuff was referencing the old version of that fn. :)

I don't think this should be intended behavior. IMHO using a test fixture implies that it is coming up with repeatable, fresh new state every time the fixture is called. To underscore that difference, with this setup there is no difference between `:each` or `:once`.

Anyway, if this is not intended behavior, it is because of this code:

https://github.com/kit-clj/kit/blob/master/libs/deps-template/resources/io/github/kit_clj/kit/test/clj/test_utils.clj#L12-L16

I changed mine to always call `core/start-app`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with libs/deps-template/resources/io/github/kit_clj/kit/test/clj/test_utils.clj, especially lines 12-16, and compare the fixture behavior with the reported core/start-app change. Reproduce the interactive workflow with :once and :each after changing a handler or API route. Done means rerunning the test observes the updated code and configuration with fresh system state.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.