Skip to content

Commit

Permalink
Add option to skip printing skipped tests (haf#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
rynoV committed Sep 10, 2024
1 parent aeea9b8 commit 3fde247
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Expecto/Expecto.Impl.fs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ module Impl =
listStates : FocusState list
/// Allows the test printer to be parametised to your liking.
printer : TestPrinters
/// Whether to show skipped tests in the output.
printSkippedTests : bool
/// Verbosity level (default: Info).
verbosity : LogLevel
/// Process name to log under (default: "Expecto")
Expand Down Expand Up @@ -536,6 +538,7 @@ module Impl =
TestPrinters.defaultPrinter
else
TestPrinters.teamCityPrinter TestPrinters.defaultPrinter
printSkippedTests = true
verbosity = Info
logName = None
locate = fun _ -> SourceLocation.empty
Expand Down Expand Up @@ -648,13 +651,18 @@ module Impl =

let beforeEach (test:FlatTest) =
let name = config.joinWith.format test.name
config.printer.beforeEach name
if config.printSkippedTests || test.shouldSkipEvaluation.IsNone then
config.printer.beforeEach name
else
async.Zero()

async {
let! beforeAsync = beforeEach test |> Async.StartChild
let! result = execTestAsync ct config test
do! beforeAsync
do! TestPrinters.printResult config test result

if config.printSkippedTests || test.shouldSkipEvaluation.IsNone then
do! TestPrinters.printResult config test result

if progressStarted && Option.isNone test.shouldSkipEvaluation then
Fraction (Interlocked.Increment testsCompleted, testLength)
Expand Down
3 changes: 3 additions & 0 deletions Expecto/Expecto.fs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ module Tests =
| Colours of int
/// Adds a test printer.
| Printer of TestPrinters
/// Whether to show skipped tests in the output.
| PrintSkippedTests of bool
/// Sets the verbosity level.
| Verbosity of LogLevel
/// Append a summary handler.
Expand Down Expand Up @@ -529,6 +531,7 @@ module Tests =
| _ -> JoinWith.Dot
}
| Printer p -> fun o -> { o with printer = p }
| PrintSkippedTests b -> fun o -> { o with printSkippedTests = b }
| Verbosity l -> fun o -> { o with verbosity = l }
| Append_Summary_Handler (SummaryHandler h) -> fun o -> o.appendSummaryHandler h

Expand Down
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 11.0.0-alpha3 - 2024-09-10
* Add option to not print skipped tests

### 11.0.0-alpha2 - 2024-08-18
* Breaking change: Update BenchmarkDotNet in Expecto.BenchmarkDotNet to 0.14.0 (#502)
* 'BenchmarkConfig' has new 'eventProcessors' and 'categoryDiscoverer' properties.
Expand Down

0 comments on commit 3fde247

Please sign in to comment.