Skip to content

Tests run concurrently within a TestSuite on Scala.js #358

@armanbilge

Description

@armanbilge
//> using dep com.lihaoyi::utest::0.8.4
//> using platform js

import utest._
import scala.concurrent._

object Demo extends TestSuite {
  def tests = Tests {
    test("foo") {
      println("foo started")
      Future(println("foo ended"))(ExecutionContext.global)
    }
    test("bar") {
      println("bar started")
      println("bar ended")
    }
  }
}
-------------------------------- Running Tests --------------------------------
foo started
bar started
bar ended
+ Demo.bar 0ms  
foo ended
+ Demo.foo 58ms  
Tests: 2, Passed: 2, Failed: 0

This is problematic when testing React applications using act:

Warning: You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions