Skip to content

Commit 20811d8

Browse files
committed
Generated scalatest-wordspec module for js.
1 parent 1d937b9 commit 20811d8

File tree

5 files changed

+40
-9
lines changed

5 files changed

+40
-9
lines changed

build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ lazy val scalatestFeatureSpecJS = ScalatestBuild.scalatestFeatureSpecJS
6565
lazy val scalatestFlatSpecJS = ScalatestBuild.scalatestFlatSpecJS
6666
lazy val scalatestFreeSpecJS = ScalatestBuild.scalatestFreeSpecJS
6767
lazy val scalatestFunSuiteJS = ScalatestBuild.scalatestFunSuiteJS
68-
lazy val scalatestPropSpecJS = ScalatestBuild.scalatestPropSpecJS
68+
lazy val scalatestPropSpecJS = ScalatestBuild.scalatestPropSpecJS
69+
lazy val scalatestWordSpecJS = ScalatestBuild.scalatestWordSpecJS

project/GenModulesJS.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,11 @@ object GenModulesJS {
9898
def genScalaTestPropSpec(targetDir: File, version: String, scalaVersion: String): Seq[File] =
9999
copyDir("scalatest/src/main/scala/org/scalatest/propspec", "org/scalatest/propspec", targetDir, List.empty)
100100

101-
/*
102-
103-
def genScalaTestRefSpec(targetDir: File, version: String, scalaVersion: String): Seq[File] =
104-
copyDir("scalatest/src/main/scala/org/scalatest/refspec", "org/scalatest/refspec", targetDir, List.empty)
105-
106101
def genScalaTestWordSpec(targetDir: File, version: String, scalaVersion: String): Seq[File] =
107102
copyDir("scalatest/src/main/scala/org/scalatest/wordspec", "org/scalatest/wordspec", targetDir, List.empty)
108103

104+
/*
105+
109106
def genScalaTestDiagrams(targetDir: File, version: String, scalaVersion: String): Seq[File] =
110107
copyDir("scalatest/src/main/scala/org/scalatest/diagrams", "org/scalatest/diagrams", targetDir, List.empty)
111108

project/JsBuild.scala

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,39 @@ trait JsBuild { this: BuildCommons =>
646646
"Bundle-Vendor" -> "Artima, Inc.",
647647
"Main-Class" -> "org.scalatest.tools.Runner"
648648
)
649-
).dependsOn(scalatestCoreJS).enablePlugins(ScalaJSPlugin)
649+
).dependsOn(scalatestCoreJS).enablePlugins(ScalaJSPlugin)
650+
651+
lazy val scalatestWordSpecJS = Project("scalatestWordSpecJS", file("modules/js/scalatest-wordspec.js"))
652+
.enablePlugins(SbtOsgi)
653+
.settings(sharedSettings: _*)
654+
.settings(
655+
projectTitle := "ScalaTest WordSpec JS",
656+
organization := "org.scalatest",
657+
name := "scalatest-wordspec",
658+
scalacOptions ++= Seq("-P:scalajs:mapSourceURI:" + rootProject.base.toURI + "->https://raw.githubusercontent.com/scalatest/scalatest/v" + version.value + "/"),
659+
Compile / sourceGenerators += {
660+
Def.task {
661+
GenModulesJS.genScalaTestWordSpec((sourceManaged in Compile).value / "scala", version.value, scalaVersion.value)
662+
}
663+
},
664+
scalacOptions ++= (if (scalaBinaryVersion.value == "2.10" || scalaVersion.value.startsWith("2.13")) Seq.empty[String] else Seq("-Ypartial-unification")),
665+
mimaPreviousArtifacts := Set(organization.value %%% moduleName.value % previousReleaseVersion),
666+
mimaCurrentClassfiles := (classDirectory in Compile).value.getParentFile / (moduleName.value + "_" + "sjs0.6_" + scalaBinaryVersion.value + "-" + releaseVersion + ".jar")
667+
).settings(osgiSettings: _*).settings(
668+
OsgiKeys.exportPackage := Seq(
669+
"org.scalatest.wordspec"
670+
),
671+
OsgiKeys.importPackage := Seq(
672+
"org.scalatest.*",
673+
"*;resolution:=optional"
674+
),
675+
OsgiKeys.additionalHeaders:= Map(
676+
"Bundle-Name" -> "ScalaTest WordSpec JS",
677+
"Bundle-Description" -> "ScalaTest.js is an open-source test framework for the Javascript Platform designed to increase your productivity by letting you write fewer lines of test code that more clearly reveal your intent.",
678+
"Bundle-DocURL" -> "http://www.scalatest.org/",
679+
"Bundle-Vendor" -> "Artima, Inc.",
680+
"Main-Class" -> "org.scalatest.tools.Runner"
681+
)
682+
).dependsOn(scalatestCoreJS).enablePlugins(ScalaJSPlugin)
650683

651684
}

scalatest/src/main/scala/org/scalatest/wordspec/AnyWordSpecLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.scalatest.wordspec
1717

18-
import org.scalactic.{FailureMessages => _, UnquotedString => _, Resources => _, _}
18+
import org.scalactic._
1919
import org.scalatest._
2020
import org.scalatest.exceptions._
2121
import Suite.autoTagClassAnnotations

scalatest/src/main/scala/org/scalatest/wordspec/AsyncWordSpecLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.scalatest.wordspec
1717

18-
import org.scalactic.{Resources => _, FailureMessages => _, UnquotedString => _, _}
18+
import org.scalactic._
1919
import org.scalatest._
2020
import scala.concurrent.Future
2121
import Suite.autoTagClassAnnotations

0 commit comments

Comments
 (0)