Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Russ White
    @russwyte
    I think I found a solution to #319 - left a comment there
    Ruslans Tarasovs
    @rtar
    I wonder if MUnit supports something like https://www.scala-sbt.org/1.x/docs/Testing.html#Output. The issue is that if you run MUnit tests in parallel, all the test reports get mixed together :blush:
    Ólafur Páll Geirsson
    @olafurpg
    @rtar MUnit uses println() by default instead of sbt loggers because the loggers introduce [info] prefixes that prevent you from copy-pasting MUnit error messages
    You can configure MUnit to use sbt loggers, which will probably make the test reports appear in-order when running parallel tests
    Ruslans Tarasovs
    @rtar

    @rtar MUnit uses println() by default instead of sbt loggers because the loggers introduce [info] prefixes that prevent you from copy-pasting MUnit error messages

    Thank you!

    By the way, reports work properly out of the box, without any additional configuration, with bloop for some reason.
    Ólafur Páll Geirsson
    @olafurpg
    @rtar it could be that Bloop buffers stdout/stderr between forked processes
    Matt Hicks
    @darkfrog26
    nvm, I can't follow instructions
    Eric K Richardson
    @ekrich
    I see you found the gitter.
    Ólafur Páll Geirsson
    @olafurpg
    Now i’m curious what the question was :))
    Eric K Richardson
    @ekrich
    He asked me on another chat whether you can nest tests - not sure if that was it or not.
    How are you? Looks like we are finally getting close to a Scala Native scalafmt.
    Matt Hicks
    @darkfrog26
    I was having an issue running Scala.js MUnit tests, but realized I hadn't properly configured my project
    Not sure if anyone else would be interested in this, but I created a prototype wrapper DSL to allow me to write my unit tests like I do in ScalaTest, but use MUnit: https://gist.github.com/darkfrog26/da9eebb9f70e9b3ac09e5e066ddc4f44
    it's just a prototype, but I wasn't sure if anyone else would care
    Eric K Richardson
    @ekrich
    And looking at another prototype/issue it looks like they didn't want to raise the complexity.
    Matt Hicks
    @darkfrog26
    Well, for me the biggest benefits are: 1.) Minimal to zero changes required in my code, 2.) Ability to define structured tests
    Eric K Richardson
    @ekrich
    Well, you can ask @olafurpg what he thinks.
    Gabriele Petronella
    @gabro

    The “no DSL” part is quite intrinsic in the design of MUnit. The general idea is that it complicates the way in which to write tests, causing divergence in style and often shifting the focus to picking the right “word”.
    (That’s my opinion, but I think @olafurpg’s one isn’t too far)

    That said, as you demonstrated, it’s not too hard to define a custom DSL on top of MUnit core functionalities. It’s very unlikely that it will be included to MUnit though

    Carlos Quiroz
    @cquiroz
    No DSL is one munit’s selling points for me 👍
    Ólafur Páll Geirsson
    @olafurpg
    There was a related discussion in scalameta/munit#112
    i think it makes sense to write a DSL to simplify the migration from ScalaTest
    My experience with ScalaTest DSLs is that people use different styles, which has caused problems when contributors send a PR using a different ScalaTest style than what’s used in the repo.
    The reason we don’t support official ScalaTest shims is because it’s a lot of effort to support 100% fidelity
    if people write their own DSLs it sets the expectation that not all ScalaTest features are supported
    Matt Hicks
    @darkfrog26
    I agree, I wasn't suggesting inclusion, but just curious if others would be interested in such a library built on top of MUnit.
    My only complaint about MUnit so far though is that there doesn't seem to be any way to create more structured test blocks to more readily comprehend the output. For example, I might have a test that defines three types of tests and I want them to define those groups and then indent tests underneath it.
    Ólafur Páll Geirsson
    @olafurpg
    Related discussion. I’m OK with adding something like describe
    it comes up frequently
    i personally haven’t felt the need so haven’t prioritized it. I opened a PR once that added arbitrary nesting but we agreed that was unnecessarily complex
    Henry Story
    @bblfish
    I asked a question on how fixtured can return test info on the scalatest mailing list here, but I think the same question applies to munit.
    bblfish
    @bblfish:matrix.org
    [m]
    (I am using both, as akka still has its tests in scalatest, and it is actually interesting to see how the two differ)
    Ólafur Páll Geirsson
    @olafurpg
    @bblfish can you provide a concrete example?
    bblfish
    @bblfish:matrix.org
    [m]
    I have a scalatest example here https://github.com/co-operating-systems/Reactive-SoLiD/blob/master/src/test/scala/run/cosy/ldp/TestSolidRouteSpec.scala#L78
    The withServer method could do with extra sections such as "creating blog post" in ... etc
    I also have a munit one with a Fixture here that could do with having subsections in the fixture https://github.com/co-operating-systems/Reactive-SoLiD/blob/master/src/test/scala/run/cosy/ldp/fs/TestAttributesFn.scala
    bblfish
    @bblfish:matrix.org
    [m]
    I can see myself adding more and more tests in both those fixtures, but the output on the console will only contain info about the outer fixture useage.
    Ólafur Páll Geirsson
    @olafurpg
    I'm still not sure I understand the problem
    Have you tried using Fixture[T] instead of FunFixture[T]?
    that's the low level API that gives you hooks for beforeAll/beforeEach/afterAll/afterEach
    You can then use test("name") { ... } like normal and access the fixture with tmpDir()
    I personally prefer Fixture[T] over FunFixture[T] because it's more flexible, requires less boilerplate, easier to compose mutiple fixtures
    bblfish
    @bblfish:matrix.org
    [m]
    ah great. That's probably what I was looking for... I'll check it out. Thanks :-)
    bblfish
    @bblfish:matrix.org
    [m]
    I found that in scalatest I can just write info("some message"), which appears in the console, and also helps me find out better where something broke.
    Eric K Richardson
    @ekrich
    Scalatest is the Swiss army knife of testing frameworks.
    Matt Hughes
    @matthughes
    Has anyone integrated https://github.com/Tapad/sbt-docker-compose with munit?
    Matt Hughes
    @matthughes
    Or more generally is anyone using munit with any Docker/container test library? There is https://github.com/testcontainers/testcontainers-scala also.
    Ólafur Páll Geirsson
    @olafurpg
    @matthughes testcontainers-scala supports MUnit