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

Reload current namespace when running tests #16

Open
SevereOverfl0w opened this issue Apr 18, 2018 · 0 comments
Open

Reload current namespace when running tests #16

SevereOverfl0w opened this issue Apr 18, 2018 · 0 comments
Labels
RFC An issue where more input is wanted

Comments

@SevereOverfl0w
Copy link
Owner

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?)
@SevereOverfl0w SevereOverfl0w added the RFC An issue where more input is wanted label Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC An issue where more input is wanted
Projects
None yet
Development

No branches or pull requests

1 participant