I am trying to define facade for : https://facebook.github.io/jest/docs/en/api.html#testonlyname-fn
@JSGlobalScope
@js.native
object JestGlobal extends js.Object {
def test(str: String, function: js.Function0[_]): Unit = js.native
@JSName("test.only")
def testOnly(str: String, function: js.Function0[_]): Unit = js.native
def expect[T](in:T) : Matcher[T] = js.native
}
@js.native
trait Matcher[T] extends js.Object {
def toBe(in:T):Unit = js.native
}
Calling a method of the global scope whose name is not a valid JavaScript identifier is not allowed. [error] See https://www.scala-js.org/doc/interoperability/global-scope.html for further information.
Edit:(Answer)
def test : JestTestObject = js.native
@js.native
trait JestTestObject extends js.Object {
def only(str: String, function: js.Function0[_]): Unit = js.native
}