Skip to content

Commit

Permalink
align output for ignored and skipped tests between all 3 platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
mzuehlke committed Apr 18, 2024
1 parent 825c032 commit cfca6bd
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ public void testAssumptionFailure(final Failure failure) {
failure.getDescription(),
new ErrorEvent(failure, Status.Skipped) {
void logTo(RichLogger logger) {
if (settings.verbose) {
logger.info(Ansi.c("==> i " + failure.getDescription().getMethodName(), WARNMSG));
}
logger.warn(
settings.buildTestResult(Status.Skipped)
+ ansiName
+ Ansi.c(" skipped", SKIPPED)
+ durationSuffix());
}
});
}
Expand Down Expand Up @@ -134,7 +136,7 @@ void logTo(RichLogger logger) {
logger.warn(
settings.buildTestResult(Status.Ignored)
+ ansiName
+ " ignored"
+ Ansi.c(" ignored", SKIPPED)
+ durationSuffix());
}
});
Expand Down Expand Up @@ -163,7 +165,7 @@ private void recordStartTime(Description description) {
private Long elapsedTime(Description description) {
Long startTime = startTimes.get(description.getMethodName());
if (startTime == null) {
return 0l;
return 0L;
} else {
return System.currentTimeMillis() - startTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,15 @@ final class JUnitReporter(
}

def reportTestIgnored(method: String): Unit = {
if (settings.verbose) {
log(Info, AnsiColors.c(s"==> i $method ignored", AnsiColors.YELLOW))
}
log(Info, AnsiColors.c(s"==> i $method ignored", AnsiColors.YELLOW))
emitEvent(method, Status.Ignored)
}
def reportAssumptionViolation(
method: String,
timeInSeconds: Double,
e: Throwable
): Unit = {
if (settings.verbose) {
log(Info, AnsiColors.c(s"==> s $method skipped", AnsiColors.YELLOW))
}
log(Info, AnsiColors.c(s"==> s $method skipped", AnsiColors.YELLOW))
emitEvent(method, Status.Skipped, new OptionalThrowable(e))
}
def reportTestPassed(method: String, elapsedMillis: Double): Unit = {
Expand Down
39 changes: 21 additions & 18 deletions tests/shared/src/main/scala/munit/SkippedFrameworkSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,35 @@ object SkippedFrameworkSuite
format = SbtFormat
)

object SkippedFrameworkStdoutOtherSuite
object SkippedFrameworkStdoutJsNativeSuite
extends FrameworkTest(
classOf[SkippedFrameworkSuite],
"""|munit.SkippedFrameworkSuite:
| + pass <elapsed time>
|==> i ignore ignored
| + assume(true) <elapsed time>
|==> s assume(false) skipped
|""".stripMargin,
format = StdoutFormat,
tags = Set(NoJVM)
)

object SkippedFrameworkStdoutOtherVerboseSuite
extends FrameworkTest(
classOf[SkippedFrameworkSuite],
"""|munit.SkippedFrameworkSuite:
|pass started
| + pass <elapsed time>
|==> i ignore ignored
|assume(true) started
| + assume(true) <elapsed time>
|assume(false) started
|==> s assume(false) skipped
|""".stripMargin,
format = StdoutFormat,
tags = Set(NoJVM),
arguments = Array("-v")
)
object SkippedFrameworkStdoutJsNativeVerboseSuite
extends FrameworkTest(
classOf[SkippedFrameworkSuite],
"""|munit.SkippedFrameworkSuite:
|pass started
| + pass <elapsed time>
|==> i ignore ignored
|assume(true) started
| + assume(true) <elapsed time>
|assume(false) started
|==> s assume(false) skipped
|""".stripMargin,
format = StdoutFormat,
tags = Set(NoJVM),
arguments = Array("-v")
)

object SkippedFrameworkStdoutJVMSuite
extends FrameworkTest(
Expand All @@ -62,6 +64,7 @@ object SkippedFrameworkStdoutJVMSuite
| + pass <elapsed time>
|==> i munit.SkippedFrameworkSuite.ignore ignored <elapsed time>
| + assume(true) <elapsed time>
|==> s munit.SkippedFrameworkSuite.assume(false) skipped <elapsed time>
|""".stripMargin,
format = StdoutFormat,
tags = Set(OnlyJVM)
Expand All @@ -78,7 +81,7 @@ object SkippedFrameworkStdoutJVMVerboseSuite
|munit.SkippedFrameworkSuite.assume(true) started
| + assume(true) <elapsed time>
|munit.SkippedFrameworkSuite.assume(false) started
|==> i assume(false)
|==> s munit.SkippedFrameworkSuite.assume(false) skipped <elapsed time>
|Test run munit.SkippedFrameworkSuite finished: 0 failed, 1 ignored, 3 total, <elapsed time>
|""".stripMargin,
format = StdoutFormat,
Expand Down
66 changes: 33 additions & 33 deletions tests/shared/src/test/scala/munit/FrameworkSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@ package munit

class FrameworkSuite extends BaseFrameworkSuite {
val tests: List[FrameworkTest] = List[FrameworkTest](
// SwallowedExceptionSuite,
// InterceptFrameworkSuite,
// CiOnlyFrameworkSuite,
// DiffProductFrameworkSuite,
// FailFrameworkSuite,
// FailSuiteFrameworkSuite,
// TestNameFrameworkSuite,
// ScalaVersionFrameworkSuite,
// FixtureOrderFrameworkSuite,
// TagsIncludeFramweworkSuite,
// TagsIncludeExcludeFramweworkSuite,
// TagsExcludeFramweworkSuite,
// SuiteTransformCrashFrameworkSuite,
// SuiteTransformFrameworkSuite,
// TestTransformCrashFrameworkSuite,
// TestTransformFrameworkSuite,
// ValueTransformCrashFrameworkSuite,
// ValueTransformFrameworkSuite,
// ScalaCheckFrameworkSuite,
// AsyncFunFixtureFrameworkSuite,
// AsyncFixtureTeardownFrameworkSuite,
// DuplicateNameFrameworkSuite,
// FullStackTraceFrameworkSuite,
// SmallStackTraceFrameworkSuite,
// AssertionsFrameworkSuite,
// Issue179FrameworkSuite,
// Issue285FrameworkSuite,
// Issue497FrameworkSuite,
// Issue583FrameworkSuite,
// ScalaCheckExceptionFrameworkSuite,
// BoxedFrameworkSuite,
SwallowedExceptionSuite,
InterceptFrameworkSuite,
CiOnlyFrameworkSuite,
DiffProductFrameworkSuite,
FailFrameworkSuite,
FailSuiteFrameworkSuite,
TestNameFrameworkSuite,
ScalaVersionFrameworkSuite,
FixtureOrderFrameworkSuite,
TagsIncludeFramweworkSuite,
TagsIncludeExcludeFramweworkSuite,
TagsExcludeFramweworkSuite,
SuiteTransformCrashFrameworkSuite,
SuiteTransformFrameworkSuite,
TestTransformCrashFrameworkSuite,
TestTransformFrameworkSuite,
ValueTransformCrashFrameworkSuite,
ValueTransformFrameworkSuite,
ScalaCheckFrameworkSuite,
AsyncFunFixtureFrameworkSuite,
AsyncFixtureTeardownFrameworkSuite,
DuplicateNameFrameworkSuite,
FullStackTraceFrameworkSuite,
SmallStackTraceFrameworkSuite,
AssertionsFrameworkSuite,
Issue179FrameworkSuite,
Issue285FrameworkSuite,
Issue497FrameworkSuite,
Issue583FrameworkSuite,
ScalaCheckExceptionFrameworkSuite,
BoxedFrameworkSuite,
SkippedFrameworkSuite,
SkippedFrameworkStdoutOtherSuite,
SkippedFrameworkStdoutJsNativeSuite,
SkippedFrameworkStdoutJVMSuite,
SkippedFrameworkStdoutOtherVerboseSuite,
SkippedFrameworkStdoutJsNativeVerboseSuite,
SkippedFrameworkStdoutJVMVerboseSuite
)
tests.foreach { t => check(t) }
Expand Down

0 comments on commit cfca6bd

Please sign in to comment.