Created
December 15, 2016 17:52
-
-
Save codyjroberts/6c32dd6616adf43464352aaa0ffceb34 to your computer and use it in GitHub Desktop.
IEx Test Helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule TestHelper do | |
@moduledoc """ | |
Reloads files and run's ExUnit tests in current directory | |
Note: Use of this helper may cause issues with state from | |
previous runs. A possible solution to this may lie in | |
spawn/1, Task, or IEx.Helpers.respawn/1 | |
""" | |
def run_tests do | |
Code.unload_files(Code.loaded_files) | |
Path.wildcard("*_test.exs") | |
|> Enum.map(& Code.load_file &1) | |
ExUnit.Server.cases_loaded | |
ExUnit.run | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment