summaryrefslogtreecommitdiff
path: root/sbt-plugin/src/main/scala/scala/scalajs/sbtplugin/testing/TestRunner.scala
blob: e5ca2a2d22eb5cc9a0db6b1a6d342a4f61a3184f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*                     __                                               *\
**     ________ ___   / /  ___      __ ____  Scala.js sbt plugin        **
**    / __/ __// _ | / /  / _ | __ / // __/  (c) 2013, LAMP/EPFL        **
**  __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \    http://scala-js.org/       **
** /____/\___/_/ |_/____/_/ | |__/ /____/                               **
**                          |/____/                                     **
\*                                                                      */


package scala.scalajs.sbtplugin.testing

import sbt.testing._

import scala.scalajs.tools.env._
import scala.scalajs.tools.classpath._

class TestRunner(
    environment: JSEnv,
    classpath: CompleteClasspath,
    jsConsole: JSConsole,
    testFramework: String,
    val args: Array[String],
    val remoteArgs: Array[String]) extends Runner {

  def tasks(taskDefs: Array[TaskDef]): Array[Task] = if (_done) {
    throw new IllegalStateException("Done has already been called")
  } else {
    taskDefs.map(TestTask(environment, classpath, jsConsole, testFramework, args))
  }

  def done(): String = {
    _done = true
    ""
  }

  private var _done = false
}