Skip to content

Commit dc99882

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

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

-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ object Platform {
1818

1919
lazy val Source = SupportSource
2020

21-
val isJvm = false
2221
}

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-12
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,17 @@ object Invoker {
5656
}
5757
val writer = files.getOrElseUpdate(dataDir, new FileWriter(measurementFile(dataDir), true))
5858

59-
// 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()
59+
if(reportTestName) writer.append(Integer.toString(id)).append(" ").append(getCallingScalaTest).append("\n").flush()
6160
else writer.append(Integer.toString(id)).append("\n").flush()
6261
ids.put(id, ())
6362
}
6463
}
6564

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-
}
65+
def getCallingScalaTest: String =
66+
Thread.currentThread.getStackTrace
67+
.map(_.getClassName.toLowerCase)
68+
.find(name => name.endsWith("suite") || name.endsWith("spec") || name.endsWith("test"))
69+
.getOrElse("")
7670

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

0 commit comments

Comments
 (0)