diff --git a/changelog.md b/changelog.md index 8fac8dab6898..3e498e7f8395 100644 --- a/changelog.md +++ b/changelog.md @@ -52,8 +52,8 @@ This simplifies code by reducing need for if-else branches around intermediate maybe nil values. Eg: `echo ?.n.typ.kind` - Added `minIndex` and `maxIndex` to the `sequtils` module - - Added `os.isRelativeTo` to tell whether a path is relative to another +- Added `resetOutputFormatters` to `unittest` ## Library changes diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index c3e3a8876be3..c50ef0b1b5a0 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -96,6 +96,8 @@ import macros, strutils, streams, times, sets, sequtils +include "system/inclrtl" + when declared(stdout): import os @@ -186,6 +188,9 @@ proc delOutputFormatter*(formatter: OutputFormatter) = keepIf(formatters, proc (x: OutputFormatter): bool = x != formatter) +proc resetOutputFormatters* {.since: (1, 1).} = + formatters = @[] + proc newConsoleOutputFormatter*(outputLevel: OutputLevel = OutputLevel.PRINT_ALL, colorOutput = true): ConsoleOutputFormatter = ConsoleOutputFormatter(