SevereOverfl0w/vim-replant

Reload current namespace when running tests

Opened this issue · 0 comments

Request

The docstring for cpr:

cpr :Require|RunTests

This essentially means that it does:

(require 'my-test-ns :reload) (clojure.test/run-tests 'my-test-ns)

There's been a request to replicate this kind of functionality.

Evaluation

Benefits:

  • Faster iteration workflow

Cons:

  • May affect the user's built-up state / be unexpected behaviour

Prior art

CIDER: Doesn't do it

Approaches

(require :reload)

This reloads only the current namespace.

Issues
  • Doesn't reload any transient dependencies
  • Doesn't do multi-methods or protocols, due to their transient nature
  • Deleted deftest (and other things) will hang around
  • Hard to explain what does & doesn't update (unexpected behaviour)
Benefits
  • Very simple
  • For the case of updating a deftest, only updates the minimum necessary

Simple refresh first

Issues
  • Slower because it reloads all changed files
  • May be unexpected that to run your tests, it reloads code on the other side of the project
  • Bypasses the state management (the system), in the case of integrant, you could potentially break the halt! multi-method
  • May remove temporary tests that have been cppd, thrown in for quick test
Benefits
  • The reload is very comprehensive, guaranteed to never leave a user scratching their head about why X didn't reload

Full refresh (including (reset))

Issues
  • Slower because it reloads all changed files
  • Slower because it (reset)s
  • May be unexpected that to run your tests, it reloads code on the other side of the project
  • Removes temporary tests that have been cppd, thrown in for quick test
Benefits
  • The reload is very comprehensive, guaranteed to never leave a user scratching their head about why X didn't reload

Do nothing

Benefits
  • Least surprising behaviour
Issues
  • More tedious when iterating on tests (mitigated by cpaF?)