Skip to content

Commit 0ff8f6c

Browse files
committed
Minor changes after ScalaJS 1.0 update
1 parent ee7a43c commit 0ff8f6c

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

scalac-scoverage-runtime/js/src/main/scala/scoverage/Platform.scala

-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ object Platform {
1717
type FileFilter = SupportFileFilter
1818

1919
lazy val Source = SupportSource
20-
21-
val isJvm = false
2220
}

scalac-scoverage-runtime/jvm/src/main/scala/scoverage/Platform.scala

-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ object Platform {
1717
type FileFilter = SupportFileFilter
1818

1919
lazy val Source = SupportSource
20-
21-
val isJvm = true
2220
}

scalac-scoverage-runtime/shared/src/main/scala/scoverage/Invoker.scala

+6-11
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,17 @@ object Invoker {
5757
val writer = files.getOrElseUpdate(dataDir, new FileWriter(measurementFile(dataDir), true))
5858

5959
// For some reason, the JS build does not print the output the correct way. I will look into this later.
60-
if(isJvm && reportTestName) writer.append(Integer.toString(id)).append(" ").append(getCallingScalaTest).append("\n").flush()
60+
if(reportTestName) writer.append(Integer.toString(id)).append(" ").append(getCallingScalaTest).append("\n").flush()
6161
else writer.append(Integer.toString(id)).append("\n").flush()
6262
ids.put(id, ())
6363
}
6464
}
6565

66-
def getCallingScalaTest: String = {
67-
val st = Thread.currentThread.getStackTrace
68-
val idx = st.indexWhere{
69-
ste => {
70-
val name = ste.getClassName.toLowerCase()
71-
name.endsWith("suite") || name.endsWith("spec") || name.endsWith("test")
72-
}
73-
}
74-
if(idx > 0) st(idx).getClassName else ""
75-
}
66+
def getCallingScalaTest: String =
67+
Thread.currentThread.getStackTrace
68+
.map(_.getClassName.toLowerCase)
69+
.find(name => name.endsWith("suite") || name.endsWith("spec") || name.endsWith("test"))
70+
.getOrElse("")
7671

7772
def measurementFile(dataDir: File): File = measurementFile(dataDir.getAbsolutePath)
7873
def measurementFile(dataDir: String): File = new File(dataDir, MeasurementsPrefix + runtimeUUID + "." + Thread.currentThread.getId)

0 commit comments

Comments
 (0)