by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Li Haoyi
    @lihaoyi
    :+1:
    hmf
    @hmf
    What is the best way to replicate JUnit's org.junit.Assert.fail? uTest seems to "only" have the assert. TIA
    Jiuyang Liu
    @sequencer
    Hello, @lihaoyi. I'm working on the problem related to #211, that I need support both 2.12 and 2.11 with utest, I found that "some test here" -{testFn} has been deprecated, and I afraid 0.6.8 and 0.7.1 will break API compatibility since this issue, will there be any solution to this?
    James Collier
    @Slakah
    Hi folks, I raised the PR lihaoyi/utest#206 quite a while ago, to fix a deprecation warning I see when building my projects using 2.13. Would greatly appreciate some feedback!
    Dmytro Kostiuchenko
    @edio
    Hi. I'm considering using utest for my project (every time I get back to tests I need to re-learn how ScalaTest works :sweat_smile: ), and it seems to fit well so far. The only thing I'm missing is tests tagging (filter tests based on tags). How do you folks solve the problem of separating slow/fast tests with utest? Do you create spearate source directories for different classes of tests?
    Dmytro Kostiuchenko
    @edio
    Dmytro Kostiuchenko
    @edio

    I guess, I'll give a try to the solution offered by frgomes

    Well, this is not very practical, as it can only be applied to the leaves of the tests tree. I ended up creating test configuratons in sbt for tags and launching them that way.

    @lihaoyi do you plan to work on lihaoyi/utest#193 some time soon? Would you be open to guiding new contributors? I'd be willing to work on it, but the idea you expressed in the last comment on that issue seems to be something more generic and I'd like to be sure, I'm working on something that fits your vision. To remind you, you wanted to attach some metadata to tests and then query it in testrunner. Could you elaborate on it a bit more please?

    Li Haoyi
    @lihaoyi
    no plans to work on it
    but i can give you pointers
    basically we would allow a user to pass in tags to the test(...) function
    perhaps as a vararg of strings
    and then extend the command line syntax for filtering based on such tags
    vito-c
    @vito-c
    I keep getting this error
    : not found: value test
    [error]     test("test3"){
    [error]     ^
    lazy val foos = project.settings(
      moduleName := "scalafix",
        resolvers ++= Seq(
          "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
          Resolver.sonatypeRepo("releases")
        ),
      libraryDependencies ++= Seq(
        "com.lihaoyi" %% "utest" % "0.6.8" % "test"
      ),
      testFrameworks += new TestFramework("utest.runner.Framework")
    )
    vito-c
    @vito-c
    when i do :
    'test1 - {
      throw new Exception("test1")
    }
    it works as expected
    is there something i'm missing?
    scalway
    @scalway
    I guess api has changed in version 0. 7 https://mvnrepository.com/artifact/com.lihaoyi/utest. Update your dependency and use test("test3") { ... }.
    Rich
    @Rich2

    I've switched to

    "Test1" -
    { ...
    }

    Is that OK syntax to use going forward?

    vito-c
    @vito-c
    @scalway does 0.7 support 2.11 T_T
    scalway
    @scalway
    Good point. 0.7 works on 2.12+ only. Then use old notation. It is supported in 0.7 version.
    "Test" - {...} and 'Test - {...} syntax is OK and only version without minus sign
    "Test1" { ... } is deprecated now. I guess @lihaoyi just decided to create less magical syntax to be default.
    scalway
    @scalway
    Oh... sorry. "Test" - {...} notation is also deprecated in newest version. Sorry for misleading.
    vito-c
    @vito-c
    how do you run one test suite using mill and utest?
    Kasper Kondzielski
    @ghostbuster91
    @lihaoyi Hi I plan to work on diffx-utest integration. Could you give me some hints how should I inject diffx output into utest assertions? TLDR diffx does pretty diffs of arbitrary structures.
    Kasper Kondzielski
    @ghostbuster91
    Currently I did the simplest thing I could, I am throwing AssertionError manually if objects does not match without touching Tracer and Assertions macros.
    softwaremill/diffx@5bc6873
    Let me know if you have any ideas how to improve this
    Li Haoyi
    @lihaoyi
    i think the easiest way would be to store the captured objects in AssertionError, add some metadata to AssertionError so we can guess if it’s a == check or not, and then add a top level error try-catch that pattern matvhes on assertion error and prints it differently
    Reto Habluetzel
    @rethab

    Hey, I'm trying to use utest in my dotty project, which I build with mill. My build file is quite simple:

    object main extends ScalaModule {
      def scalaVersion = "0.24.0-RC1"
      object test extends Tests {
        def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.4".withDottyCompat(scalaVersion()))
        def testFrameworks = Seq("utest.runner.Framework")
      }
    }

    When I try to run tests, however, it is complaining that Scala 2 macros cannot be used in dotty (coming from the Tests {).
    I saw that the code for Tests depends on the version of scala and I suspect that in my case the code for scala 2.13 is being pulled in rather than the one for dotty.

    How can I use utest in dotty?

    Reto Habluetzel
    @rethab
    I fixed it by manually publishing utest locally. After that, I could remove the withDottyCompat, because the suffix 0_24 now exists locally.
    Marc Grue
    @marcgrue

    Is there a way to test along the lines of this?:

    import scalatags.JsDom.all._
    import utest._
    
    object HtmlTest extends TestSuite  {
      val tests = Tests {
        test("html") {
          val page = html(body("Hello World")).render
          page.firstChild.textContent ==> "Hello World"
        }
      }
    }

    The above test gives me java.lang.Error: stub

    Christopher Hunt
    @huntc
    Hey everyone - are there any known issues when using match expressions within an eventually function? I'm using 0.6.9, but I've also tried the 0.7 releases. I see the compiler blow up:
    [error]         during phase: typer
    [error]      library version: version 2.12.10
    [error]     compiler version: version 2.12.10
    [error]   reconstructed args: ... 
    [error] 
    [error]   last tree to typer: UnApply
    [error]        tree position: line 215 of EndDeviceServiceTest.scala
    [error]               symbol: null
    [error]            call site: object EndDeviceServiceTest in package controlcenter in package controlcenter
    [error] 
    [error] == Source file context for tree position ==
    [error] 
    [error]    212             val expectedPosition = LatLng(-20, 20, None)
    [error]    213 
    [error]    214             events match {
    [error]    215               case Seq(
    [error]    216                   Snapshots.StoredEvent(
    [error]    217                     EndDeviceEvents.NameUpdated(1, "some-name")),
    [error]    218                   Snapshots.StoredEvent(EndDeviceEvents.SecretsUpdated(1, _)),
    Li Haoyi
    @lihaoyi
    yeah the macros are a bit buggy around matches
    workaround is to move it into a helper function you call
    Christopher Hunt
    @huntc
    ah right -thanks - I shall try that
    Perfect answer. Thanks @lihaoyi
    Todd O'Bryan
    @toddobryan
    I'm getting a bunch of errors in IntelliJ where it highlights the block in test("whatever") /* this part --> */{ ... } /* <-- */ with the error 'Any' does not take parameters. Everything compiles fine, and I can even run the test from IntelliJ, so I guess it's an IntelliJ bug, but is there some way to let IntelliJ know what's going on so it doesn't show an error?
    Li Haoyi
    @lihaoyi
    I see those errors too, pretty annoying :/ not sure what to do about them
    Todd O'Bryan
    @toddobryan
    Well, as long as it's not just me. :-) Is test a macro? I guess it could just be confused...
    Todd O'Bryan
    @toddobryan
    BTW, just checking to make sure, but is Li your family name, so I should call you Mr. Li or Haoyi?
    Li Haoyi
    @lihaoyi
    Li is family name
    Todd O'Bryan
    @toddobryan
    There are two IntelliJ bugs about this problem: https://youtrack.jetbrains.com/issue/SCL-17604 and https://youtrack.jetbrains.com/issue/SCL-16046. The older one, the bug went away if you removed the package declaration, but that doesn't seem to help in newer versions, so 17604 seems like it needs to be re-opened as not a duplicate.
    Marc Grue
    @marcgrue
    Seems there's conflict between utest and scalatags. Does anyone see the errors in projects without a scalatags dependency (only version 0.8.4 onwards conflict)? In this minified example project, simply uncommenting the scalatags dependency removes the utest false error (even if scalatags are not imported/used at all).
    Marc Grue
    @marcgrue
    IntelliJ told me they found the cause and that a fix is on its way...
    Yarek T
    @YarekTyshchenko
    Hi. I'm trying to run some integration tests with utest. The stack is within a Resource, and I'd like to execute it once, run all the tests inside it, then shut it down. Using IOTestSuite, can't see a way to do it, as tests is a val / whole thing is an object
    We did this with ScalaTest Async because individual tests returned F[Assertion], which could be composed
    Bruno Medeiros
    @bruno-medeiros
    Heya folks, Intellij is giving me a 'Any' does not take parameters error on utest, any idea what it could be? (running test on sbt goes just fine)
    Ben Spencer
    @dangerousben
    is there a nicer way to assert that two Lists contain the same elements (ignoring order) than just converting them to Sets?
    Minghao Liu
    @molikto
    how can I use snapshot version for Dotty new version?
    jodersky
    @jodersky
    You'll need to build utest yourself if it isn't published for the version of dotty you're looking for
    ./mill -i -D dottyVersion="<version>" utest.jvm[<version>].publishLocal
    it might also be worth checking out if there are any outstanding fixes in the dotty community build version of utest https://github.com/dotty-staging/utest