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

Add fail if any wip tests config setting & docs #381

Merged
merged 1 commit into from
Sep 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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