Search code examples
unit-testingf#expecto

How to set --summary in the test assembly in Expecto


Expecto allows you to set parameters via CLIArguments and also by overriding its defaultConfig. One of the parameters is --summary. Currently I just directly pass "--summary" and merge it with argv but is there a parameter (I assume 'printer') that can be overridden? In that case, how? This is what I do now:

open Expecto
open Expecto.Impl
open Expecto.Logging

[<EntryPoint>]
let main argv =
    let defaultConfig = {
            defaultConfig with
                colour = Logging.Colour256
                verbosity = LogLevel.Info
        }
    let argv = Array.append argv [|"--summary"|]
    Tests.runTestsInAssembly defaultConfig argv

Solution

  • From source code

    | Summary -> fun o -> {o with printer = TestPrinters.summaryPrinter o.printer}