Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fixture does not reload system state when running tests interactively #148

Open
positron opened this issue Sep 12, 2024 · 3 comments
Open

Comments

@positron
Copy link

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 (<my-ns>.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.

@vollcheck
Copy link
Contributor

vollcheck commented Sep 17, 2024

Do you, after step 2nd, run (reset) from the REPL?

@positron
Copy link
Author

No. That would probably work too.

If that's the intended workflow feel free to close. It's just not the workflow I'm used to coming from some older clojure projects based on stuartsierra/component.

@vollcheck
Copy link
Contributor

The thing is that reloading whole project on save might result in REPL lags especially in bigger applications hence proposed approach with reloaded workflow.

Feel free to modify project settings to your need though.

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

No branches or pull requests

2 participants