Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update static test #358

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@ name := "static"

enablePlugins(ScalaJSBundlerPlugin, ScalaJSJUnitPlugin)

scalaVersion := "2.11.12"
scalaVersion := "2.13.3"

scalaJSUseMainModuleInitializer := true

libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.0.0"

npmDependencies in Compile += "snabbdom" -> "0.5.3"

npmDevDependencies in Compile += "uglifyjs-webpack-plugin" -> "1.2.2"

// Use a different Webpack configuration file for production
webpackConfigFile in fullOptJS := Some(baseDirectory.value / "prod.webpack.config.js")

Expand All @@ -20,6 +18,8 @@ requireJsDomEnv in Test := true

version in installJsdom := "16.2.0"

version in webpack := "4.44.1"

webpackBundlingMode := BundlingMode.LibraryAndApplication()

useYarn := true
Expand Down Expand Up @@ -50,7 +50,7 @@ TaskKey[Unit]("checkSize") := {
val artifactSize = IO.readBytes(bundleFile).length

val sizeLow = 17000
val sizeHigh = 22000
val sizeHigh = 29000

// Account for minor variance in size due to transitive dependency updates
assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</head>
<body>
<div id="container"></div>
<script src="target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js"></script>
<script src="target/scala-2.13/scalajs-bundler/main/static-opt-bundle.js"></script>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</head>
<body>
<div id="container"></div>
<script src="target/scala-2.11/scalajs-bundler/main/static-fastopt-bundle.js"></script>
<script src="target/scala-2.13/scalajs-bundler/main/static-fastopt-bundle.js"></script>
</body>
</html>
</html>
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
var UglifyJsPlugin = require("uglifyjs-webpack-plugin");

module.exports = require("./scalajs.webpack.config");

module.exports.plugins = (module.exports.plugins || []).concat([
new UglifyJsPlugin({ sourceMap: module.exports.devtool === "source-map" })
]);
module.exports.optimization = {
minimize: true,
};
20 changes: 10 additions & 10 deletions sbt-scalajs-bundler/src/sbt-test/sbt-scalajs-bundler/static/test
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
$ absent target/scala-2.11/scalajs-bundler/main/static-fastopt-bundle.js target/scala-2.11/scalajs-bundler/main/static-fastopt-bundle.js.map
$ absent target/scala-2.13/scalajs-bundler/main/static-fastopt-bundle.js target/scala-2.13/scalajs-bundler/main/static-fastopt-bundle.js.map
> fastOptJS::webpack
$ exists target/scala-2.11/scalajs-bundler/main/static-fastopt-bundle.js target/scala-2.11/scalajs-bundler/main/static-fastopt-bundle.js.map
$ exists target/scala-2.13/scalajs-bundler/main/static-fastopt-bundle.js target/scala-2.13/scalajs-bundler/main/static-fastopt-bundle.js.map
> html index.html

$ absent target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js.map
$ absent target/scala-2.13/scalajs-bundler/main/static-opt-bundle.js target/scala-2.13/scalajs-bundler/main/static-opt-bundle.js.map
> fullOptJS::webpack
$ exists target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js.map
$ exists target/scala-2.13/scalajs-bundler/main/static-opt-bundle.js target/scala-2.13/scalajs-bundler/main/static-opt-bundle.js.map
> html index-prod.html
> checkSize

Expand All @@ -14,22 +14,22 @@ $ exists target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js target/scal
> clean
> set scalaJSLinkerConfig := scalaJSLinkerConfig.value.withSourceMap(false)
> fastOptJS::webpack
$ absent target/scala-2.11/scalajs-bundler/main/static-fastopt-bundle.js.map
$ absent target/scala-2.13/scalajs-bundler/main/static-fastopt-bundle.js.map
> fullOptJS::webpack
$ absent target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js.map
$ absent target/scala-2.13/scalajs-bundler/main/static-opt-bundle.js.map

# webpackEmitSourceMaps controls source maps emission for the webpack task

> clean
> set scalaJSLinkerConfig := scalaJSLinkerConfig.value.withSourceMap(true)
> set webpackEmitSourceMaps in (Compile, fastOptJS) := false
> fastOptJS::webpack
$ exists target/scala-2.11/scalajs-bundler/main/static-fastopt.js.map
$ absent target/scala-2.11/scalajs-bundler/main/static-fastopt-bundle.js.map
$ exists target/scala-2.13/scalajs-bundler/main/static-fastopt.js.map
$ absent target/scala-2.13/scalajs-bundler/main/static-fastopt-bundle.js.map

> set webpackEmitSourceMaps in (Compile, fullOptJS) := false
> fullOptJS::webpack
$ exists target/scala-2.11/scalajs-bundler/main/static-opt.js.map
$ absent target/scala-2.11/scalajs-bundler/main/static-opt-bundle.js.map
$ exists target/scala-2.13/scalajs-bundler/main/static-opt.js.map
$ absent target/scala-2.13/scalajs-bundler/main/static-opt-bundle.js.map

> test