From fa15554ff30921ed6e1d4959f3937ca4a0f1756f Mon Sep 17 00:00:00 2001 From: Jason Axelson Date: Fri, 4 Oct 2019 07:49:14 -1000 Subject: [PATCH] Clear the screen before each test run --- History.md | 1 + README.md | 9 +++++++++ config/config.exs | 3 ++- lib/cortex/test_runner.ex | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/History.md b/History.md index 426c883..e77e64c 100644 --- a/History.md +++ b/History.md @@ -2,6 +2,7 @@ Unreleased ========== * feat: File throttling to prevent files being compiled multiple times in quick succession and tests being run multiple times due to one "change". + * feat: by default clear the screen before each test run (configurable with `clear_before_running_tests`) 0.5.0 / 2018-05-01 ================== diff --git a/README.md b/README.md index dc75a0f..c4f6cb5 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,15 @@ config :cortex, disabled: {:system, "CI_RUN", false} ``` +## Configuring + +```ex +config :cortex, + clear_before_running_tests: true +``` + +Set `clear_before_running_tests` to clear the screen immediately before running tests, defaults to true. + ## Phoenix If you are running a phoenix application, diff --git a/config/config.exs b/config/config.exs index 7ecf341..5333cad 100644 --- a/config/config.exs +++ b/config/config.exs @@ -30,4 +30,5 @@ use Mix.Config # import_config "#{Mix.env}.exs" config :cortex, enabled: {:system, "CORTEX_ENABLED", true}, - disabled: {:system, "CORTEX_DISABLED", false} + disabled: {:system, "CORTEX_DISABLED", false}, + clear_before_running_tests: true diff --git a/lib/cortex/test_runner.ex b/lib/cortex/test_runner.ex index aa372b9..f525051 100644 --- a/lib/cortex/test_runner.ex +++ b/lib/cortex/test_runner.ex @@ -144,6 +144,10 @@ defmodule Cortex.TestRunner do # present if focus == nil, do: clear_focus() + if Application.get_env(:cortex, :clear_before_running_tests, true) do + IEx.Helpers.clear() + end + files_to_load = [test_helper | files] compiler_errors =