Skip to content

Commit

Permalink
Add fail if any wip tests config setting & docs (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick authored and lefthandedgoat committed Sep 4, 2017
1 parent 8736d1e commit decac43
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/content/configuration.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ wipSleep
*)
wipSleep <- 1.0

(**
failIfAnyWipTests
--------
* Prevents accidentally allowing wip tests into the build pipeline.
* Set to false locally so tests under development are not affected.
* Set to true in your CI environment to catch wip tests that have been mistakenly commited to trunk/master.
* Default is false
*)
failIfAnyWipTests <- true

(**
runFailedContextsFirst
-----
Expand Down
2 changes: 2 additions & 0 deletions src/canopy/configuration.fs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ let mutable pageTimeout = 10.0
(* documented/configuration *)
let mutable wipSleep = 1.0
(* documented/configuration *)
let mutable failIfAnyWipTests = false
(* documented/configuration *)
let mutable runFailedContextsFirst = false
(* documented/configuration *)
let mutable reporter : IReporter = new ConsoleReporter() :> IReporter
Expand Down
8 changes: 7 additions & 1 deletion src/canopy/runner.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ let private runtest (suite : suite) (test : Test) =

(* documented/testing *)
let run () =

let wipsExist = suites |> List.exists (fun s -> s.Wips.IsEmpty = false)

if wipsExist && configuration.failIfAnyWipTests then
raise <| Exception "Wip tests found and failIfAnyWipTests is true"

reporter.suiteBegin()
let stopWatch = new Diagnostics.Stopwatch()
stopWatch.Start()
Expand All @@ -194,7 +200,7 @@ let run () =
suites <- fc @ pc

//run only wips if there are any
if suites |> List.exists (fun s -> s.Wips.IsEmpty = false) then
if wipsExist then
suites <- suites |> List.filter (fun s -> s.Wips.IsEmpty = false || s.Always.IsEmpty = false)

suites
Expand Down

0 comments on commit decac43

Please sign in to comment.