Skip to content

Running tests with munit and Scala.js breaks for Scala 3.7 #22794

Closed
@Gedochao

Description

@Gedochao

Compiler version

Scala 3.7.0-RC1, 3.7.0-RC1-bin-20250312-3fe9304-NIGHTLY
Scala.js 1.18.2

Minimized code

//> using dep org.scalameta::munit::1.1.0
//> using platform js
//> using scala 3.7.0-RC1

class MyTests extends munit.FunSuite {
  test("foo") {
    assert(2 + 2 == 4)
  }
}

Output

scala test .
Compiling project (test, Scala 3.7.0-RC1, Scala.js 1.18.2)
Compiled project (test, Scala 3.7.0-RC1, Scala.js 1.18.2)
Referring to non-existent method scala.runtime.Arrays$.newArray(java.lang.Class,java.lang.Class,[int)java.lang.Object
  dispatched from scala.runtime.Arrays$.newArray(java.lang.Class,java.lang.Class,[int)java.lang.Object
  called from munit.internal.io.Files$.readAllBytes(munit.internal.io.MunitPath)[byte
  called from munit.internal.io.Files$.readAllLines(munit.internal.io.MunitPath)java.util.List
  called from munit.internal.io.PlatformIO$Files$.readAllLines(munit.internal.io.MunitPath)java.util.List
  called from private static munit.internal.console.Lines.$anonfun$1(munit.internal.io.MunitPath)[java.lang.String
  called from munit.internal.console.Lines.formatLine(munit.Location,java.lang.String,munit.Clues,boolean)java.lang.String
  called from munit.Assertions.fail(java.lang.String,munit.Clues,munit.Location,munit.diff.DiffOptions)nothing
  called from private munit.Assertions.assert$$anonfun$1(scala.Function0,scala.Function0,munit.Location)void
  called from private munit.Assertions.assert$$anonfun$adapted$1(scala.Function0,scala.Function0,munit.Location)java.lang.Object
  called from munit.Assertions.assert(scala.Function0,scala.Function0,munit.Location)void
  called from munit.FunSuite.assert(scala.Function0,scala.Function0,munit.Location)void
  dispatched from MyTests.assert(scala.Function0,scala.Function0,munit.Location)void
  called from private MyTests.$init$$$anonfun$1()java.lang.Object
  called from constructor MyTests.<init>()void
  called from static constructor MyTests.<stinit>()void
  called from core module analyzer
involving instantiated classes:
  munit.internal.io.Files$
  munit.internal.io.PlatformIO$Files$
  munit.internal.console.Lines
  MyTests
Exception in thread "main" org.scalajs.linker.interface.LinkingException: There were linking errors
        at org.scalajs.linker.analyzer.Analyzer.reportErrors(Analyzer.scala:92)
        at org.scalajs.linker.analyzer.Analyzer.$anonfun$computeReachability$1(Analyzer.scala:68)
        at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
        at java.base@17.0.6/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
        at java.base@17.0.6/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base@17.0.6/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base@17.0.6/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base@17.0.6/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base@17.0.6/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
[error]  Error: main.js not found after Scala.js linking (no files found)

Expectation

Should run the tests with munit + Scala.js fine, as up to Scala 3.6.4.

scala test . -S 3.6.4    
Compiling project (test, Scala 3.6.4, Scala.js 1.18.2)
Compiled project (test, Scala 3.6.4, Scala.js 1.18.2)
MyTests:
  + foo 0.002s

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions