by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    P. Oscar Boykin
    @johnynek
    which, is pretty maddening... since I have no idea what threw it.
    here is an example:
    > Exception: java.lang.ClassCastException: null at munit.Assertions.fail(Assertions.scala:178)
    that should be two lines, but I gitter didn't seem to respect the newline
    P. Oscar Boykin
    @johnynek
    it could be the exception itself somehow doesn't have a stacktrace
    P. Oscar Boykin
    @johnynek
    well... I don't think this is an munit issue... the problem was scalac letting something incorrect typecheck (in a GADT setting) and that generating a castclass at runtime which had no stacktrace.
    Ólafur Páll Geirsson
    @olafurpg
    @johnynek munit does trim stack traces quite aggressively, sometimes a bit too much I think
    I have considered adding a -F flag similar to ScalaTest to disable stacktrace trimming
    Ólafur Páll Geirsson
    @olafurpg
    @/all MUnit v0.7.6 is out with several important bug fixes, I encourage everybody to upgrade ASAP https://github.com/scalameta/munit/releases/tag/v0.7.6
    @johnynek that release includes a new -F flag that disables stacktrace trimming
    P. Oscar Boykin
    @johnynek
    @olafurpg thanks! That's great. I'll try it! Really loving munit so far
    P. Oscar Boykin
    @johnynek
    -F works but I'm still seeing cases that confuse me. I'm seeing a > Exception: java.lang.StackOverflowError: null but I have no idea where in my code this is
    (this is with the scalacheck integration)
    here is the full stack -F reports:

    ```Exception raised on property evaluation.

    Exception: java.lang.StackOverflowError: null
    at munit.Assertions.fail(Assertions.scala:189)
    at munit.Assertions.fail$(Assertions.scala:183)
    at munit.FunSuite.fail(FunSuite.scala:11)
    at munit.ScalaCheckSuite.$anonfun$propToTry$4(ScalaCheckSuite.scala:84)
    at scala.util.Try$.apply(Try.scala:210)
    at munit.ScalaCheckSuite.propToTry(ScalaCheckSuite.scala:84)
    at munit.ScalaCheckSuite.$anonfun$scalaCheckPropTransform$3(ScalaCheckSuite.scala:44)
    at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:438)
    at munit.Suite$$anon$1.execute(Suite.scala:25)
    at scala.concurrent.impl.Promise$Transformation.submitWithValue(Promise.scala:392)
    at scala.concurrent.impl.Promise$DefaultPromise.submitWithValue(Promise.scala:302)
    at scala.concurrent.impl.Promise$DefaultPromise.dispatchOrAddCallbacks(Promise.scala:276)
    at scala.concurrent.impl.Promise$DefaultPromise.transform(Promise.scala:128)
    at munit.internal.FutureCompat$ExtensionFuture.transformCompat(FutureCompat.scala:16)
    at munit.ScalaCheckSuite.$anonfun$scalaCheckPropTransform$2(ScalaCheckSuite.scala:46)
    at munit.GenericTest.$anonfun$withBodyMap$1(GenericTest.scala:33)
    at munit.MUnitRunner.$anonfun$runTestBody$1(MUnitRunner.scala:283)
    at munit.internal.console.StackTraces$.dropOutside(StackTraces.scala:12)
    at munit.MUnitRunner.runTestBody(MUnitRunner.scala:279)
    at munit.MUnitRunner.runTest(MUnitRunner.scala:261)
    at munit.MUnitRunner.loop$1(MUnitRunner.scala:121)
    at munit.MUnitRunner.runAsyncTestsSynchronously(MUnitRunner.scala:130)
    at munit.MUnitRunner.runAll(MUnitRunner.scala:143)
    at munit.MUnitRunner.runAsync(MUnitRunner.scala:103)
    at munit.MUnitRunner.run(MUnitRunner.scala:98)
    at munit.internal.junitinterface.JUnitRunnerWrapper.run(JUnitRunnerWrapper.java:24)```

    so, cutting all that out seems fine, none of it was my code...
    another annoying thing, I can't see the input that causes the error. that would be helpful.
    Ólafur Páll Geirsson
    @olafurpg
    @johnynek from what I can see, we're missing the original exception in ScalaCheckSuite when the failure is not a FailException https://github.com/scalameta/munit/blob/e038fe1f72dcba5f04cbd4ebc542af2e5f472af1/munit-scalacheck/shared/src/main/scala/munit/ScalaCheckSuite.scala#L78-L84
    This looks like an issue in the scalacheck integration
    P. Oscar Boykin
    @johnynek
    ahh. good find
    Ólafur Páll Geirsson
    @olafurpg
    Please report an issue, should be an easy fix. It would be nice to have a minimized repro, maybe this does the trick
    prop("foo") { foreach(i: Int => throw new StackOverflowException(..)) }
    P. Oscar Boykin
    @johnynek
    will do
    Ólafur Páll Geirsson
    @olafurpg
    we may also want to change some other code in MUnit to catch Throwable instead of NonFatal
    based on my experience with worksheets in metals, it seems quite common to recover from "fatal" errors :)
    (I mean, the necessity in a framework to recover from fatal errors when invoking user code)
    P. Oscar Boykin
    @johnynek
    Eyal Roth
    @eyalroth
    Hey! a question about licensing. I noticed the NOTICE.md page, but since I'm no expert on this, I was wondering - can I use munit in production code -- i.e, redistribute it as part of my for-profit close-sourced product?
    Ólafur Páll Geirsson
    @olafurpg
    @eyalroth MUnit is Apache 2 licensed and I think you can use it the same way as you use scala-library.jar
    Eyal Roth
    @eyalroth
    @olafurpg Great, thank you :)
    Milan van der Meer
    @milanvdm
    @olafurpg Would there be interest in a cats-module for munit? Some integration atm don't work nicely, for example creating a Fixture based on a Resource[F[_], A].
    Ólafur Páll Geirsson
    @olafurpg
    @milanvdm i think that’s a good idea and I’m happy to host it in the munit repo and review the design
    Milan van der Meer
    @milanvdm
    Cool, will have a look later on to see if I can come up with something decent or not :)
    Milan van der Meer
    @milanvdm
    @olafurpg Cats-effect doesnt support Scala Native though. So that module would only publish for JS and JVM.
    Ólafur Páll Geirsson
    @olafurpg
    @milanvdm that's fine, integration modules don't need to support the full cross-matrix
    Ólafur Páll Geirsson
    @olafurpg
    I drafted an implementation to support nested tests, curious to hear what people think scalameta/munit#133
    I have personally never used such a feature in other testing libraries, but it's supported by JUnit and seems useful(?)
    Milan van der Meer
    @milanvdm
    @olafurpg I created a draft PR for cats-effect: scalameta/munit#134
    Ryan Peters
    @sloshy
    I just switched over my tests to MUnit, and for some reason in one of my files it is not reporting results from every test. I think they run, but it only reports three of them.
    I can try and upload a sample, but it's a pretty large file in a project with a lot of custom domain logic, and it's in a private repo. I can say, I'm using the scalacheck integration, and every one of my tests is a Prop (in a property block)
    sbt:mymedialog-mediadb> test
    [info] Compiling 1 Scala source to /home/ryan/Projects/mymedialog-mediadb/target/scala-2.13/test-classes ...
    io.medialog.mediadb.RouteSpec:
      + GET -> /[type]/[id] should fail on an invalid type string 0.863s
      + POST -> /new should add unique, new items only 0.294s
      + POST -> /[type]/[id]/names should fail on an invalid type string 0.054s
    [info] Passed: Total 3, Failed 0, Errors 0, Passed 3
    [success] Total time: 13 s, completed May 30, 2020, 3:49:15 PM
    The total time tells me it is doing a lot of extra tests, as that's how long I'd expect the whole suite to run. Furthermore, if I comment out a test, it will report the next test just fine
    Right now it is reporting the 1st, 4th, and 5th tests in the suite. If I comment out the 1st, it will report the 2nd, 4th, and 5th
    And so on
    Ólafur Páll Geirsson
    @olafurpg
    @sloshy are you using the latest version?
    Ryan Peters
    @sloshy
    0.7.7
    So, since the file was very large, I split it into about 4/5 different test suites, and interestingly it runs them all but only reports results from the last one
    sbt:mymedialog-mediadb> test
    [info] Compiling 7 Scala sources to /home/ryan/Projects/mymedialog-mediadb/target/scala-2.13/test-classes ...
    io.medialog.mediadb.NewEditionRouteSuite:
    io.medialog.mediadb.NameRouteSuite:
    io.medialog.mediadb.RenameRouteSuite:
    io.medialog.mediadb.ItemRouteSuite:
    io.medialog.mediadb.ModifyLocalesRouteSuite:
      + POST -> /[type]/[id]/names/modify-locales should fail on an invalid type string 0.897s
      + POST -> /[type]/[id]/editions/new should fail on an invalid type string 0.914s
      + POST -> /[type]/[id]/names/rename should fail on an invalid type string 0.917s
      + GET -> /[type]/[id] should fail on an invalid type string 0.919s
      + POST -> /[type]/[id]/names should fail on an invalid type string 0.925s
      + POST -> /new should add unique, new items only 0.366s
    [info] Passed: Total 6, Failed 0, Errors 0, Passed 6
    [success] Total time: 9 s, completed May 30, 2020, 4:31:30 PM
    Ólafur Páll Geirsson
    @olafurpg
    Please report an issue and include as much details as you can
    Ryan Peters
    @sloshy
    Absolutely, will do.
    Ryan Peters
    @sloshy
    @olafurpg scalameta/munit#138 let me know if anything else is needed!