Skip to content

Commit 9f484dc

Browse files
committed
Separate emission expectations by Scala version
1 parent f0e130f commit 9f484dc

File tree

6 files changed

+44
-2
lines changed

6 files changed

+44
-2
lines changed

library/project/Build.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,14 @@ object ScalaJsReact {
223223
Test / fork := true,
224224
Test / javaOptions ++= {
225225
val jsOutputDir = (testEmissionsJS / Compile / fastLinkJS / scalaJSLinkerOutputDirectory).value
226+
val scalaVer = scalaVersion.value
226227
val tempDir = (Test / classDirectory).value
227228
val testResDir = (Test / resourceDirectory).value
228229
val testRootDir = (Test / sourceDirectory).value
229230
Seq(
230231
s"-DCI=${if (inCI) "1" else "0"}",
231232
s"-DjsOutputDir=${jsOutputDir.absolutePath}",
233+
s"-DscalaVer=$scalaVer",
232234
s"-DtempDir=${tempDir.absolutePath}",
233235
s"-DtestResDir=${testResDir.absolutePath}",
234236
s"-DtestRootDir=${testRootDir.absolutePath}",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
function $c_Lsjr_test_emissions_UseState$() {
2+
this.Lsjr_test_emissions_UseState$__f_Component = null;
3+
$n_Lsjr_test_emissions_UseState$ = this;
4+
$j_sjr_package$.$m_Lsjr_package$();
5+
var this$4 = $j_sjr_hooks_HookComponentBuilder$.$m_Lsjr_hooks_HookComponentBuilder$().apply__Lsjr_hooks_HookComponentBuilder$ComponentP$First();
6+
var initialState = new $j_AnonFunction0.$c_sjsr_AnonFunction0(() => 123);
7+
var step = new $j_sjr_hooks_HookComponentBuilder$ComponentP$FirstStep.$c_Lsjr_hooks_HookComponentBuilder$ComponentP$FirstStep();
8+
var this$18 = $j_sjr_hooks_Api$SecondaryWithRender.$as_Lsjr_hooks_Api$SecondaryWithRender($j_sjr_hooks_Api$Primary.$f_Lsjr_hooks_Api$Primary__useState__F0__Lsjr_hooks_Api$AbstractStep__O(this$4, initialState, step));
9+
var f = new $j_AnonFunction2.$c_sjsr_AnonFunction2((x$1$2, s$2) => {
10+
$j_java_lang_Object.$as_jl_Void(x$1$2);
11+
var s = $j_sjr_hooks_Hooks$UseStateF.$as_Lsjr_hooks_Hooks$UseStateF(s$2);
12+
var $$x2 = $j_sjr_vdom_HtmlTagOf$.$m_Lsjr_vdom_HtmlTagOf$();
13+
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
14+
$j_sjr_vdom_Exports$.$m_Lsjr_vdom_Exports$();
15+
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
16+
$j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$();
17+
var $$x1 = new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1("Count is ");
18+
$j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$();
19+
var v = $j_java_lang_Object.$uI(s.Lsjr_hooks_Hooks$UseStateF$$anon$2__f_raw[0]);
20+
$j_sjr_vdom_VdomNode$.$m_Lsjr_vdom_VdomNode$();
21+
var array = [$$x1, new $j_sjr_vdom_VdomNode$$anon$1.$c_Lsjr_vdom_VdomNode$$anon$1(v), $j_sjr_vdom_html_$.$m_Lsjr_vdom_html_$().Lsjr_vdom_html_$__f_$up.Lsjr_vdom_HtmlAttrAndStyles$__f_onClick.$minus$minus$greater__F0__F1__Lsjr_vdom_TagMod(new $j_AnonFunction0.$c_sjsr_AnonFunction0((s$1 => () => {
22+
$j_sjr_Reusable$.$m_Lsjr_Reusable$();
23+
var r = $j_sjr_hooks_Hooks$UseStateF.$f_Lsjr_hooks_Hooks$UseStateF__modState__Lsjr_Reusable(s$1);
24+
return new $j_sjr_callback_CallbackTo.$c_Lsjr_callback_CallbackTo($j_sjr_callback_CallbackTo.$as_Lsjr_callback_CallbackTo($j_scala_Function1.$as_F1(r.value__O()).apply__O__O(new $j_scala_Function1.$c_sjsr_AnonFunction1(x$2$2 => {
25+
var x$2 = $j_java_lang_Object.$uI(x$2$2);
26+
return 1 + x$2 | 0;
27+
}))).Lsjr_callback_CallbackTo__f_japgolly$scalajs$react$callback$CallbackTo$$trampoline);
28+
})(s)), $j_sjr_vdom_Attr$EventCallback$.$m_Lsjr_vdom_Attr$EventCallback$().Lsjr_vdom_Attr$EventCallback$__f_defaultSync)];
29+
return $$x2.apply$extension__T__sci_Seq__Lsjr_vdom_TagOf("button", new $j_WrappedVarArgs.$c_sjsr_WrappedVarArgs(array));
30+
});
31+
var this$17 = $j_sjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$.$m_Lsjr_hooks_HookComponentBuilder$ComponentP$SubsequentStep$();
32+
var step$1 = new $j_sjr_hooks_ComponentP_SubsequentSteps$$anon$1.$c_Lsjr_hooks_ComponentP_SubsequentSteps$$anon$1(this$17);
33+
var s$3 = $j_sjr_CtorType$Summoner$.$m_Lsjr_CtorType$Summoner$().summonN__Lsjr_internal_Singleton__Lsjr_CtorType$Summoner($j_sjr_internal_Singleton$.$m_Lsjr_internal_Singleton$().Lsjr_internal_Singleton$__f_BoxUnit);
34+
this.Lsjr_test_emissions_UseState$__f_Component = $j_sjr_hooks_Api$SecondaryWithRender.$f_Lsjr_hooks_Api$SecondaryWithRender__render__O__Lsjr_hooks_Api$SubsequentStep__Lsjr_CtorType$Summoner__Lsjr_component_JsBaseComponentTemplate$ComponentWithRoot(this$18, f, step$1, s$3);
35+
}
36+
37+
export { $c_Lsjr_test_emissions_UseState$ };

library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/EmissionTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ object EmissionTest extends TestSuite {
2929
val name = tp.value.last
3030
val actualFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js"
3131
val tempFilename = s"${Props.tempDir}/$name.js"
32-
val expectFilename = s"${Props.testResDir}/${Props.resSubdirScala}/$name-out.js"
32+
val expectFilename = s"${Props.testResDir}/${Props.resSubdirScala}/$name-out${Props.scalaMajorVer}.js"
3333
var utestOutput = () : Any
3434

3535
val actual = {

library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/ReactRefreshTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object ReactRefreshTest extends TestSuite {
5151
val name = tp.value.last
5252
val actualFilename = s"${Props.jsOutputDir}/$pkg.$name" + "$.js"
5353
val tempFilename = s"${Props.tempDir}/$name.js"
54-
val expectFilename = s"${Props.testResDir}/${Props.resSubdirScalaRR}/$name-out.js"
54+
val expectFilename = s"${Props.testResDir}/${Props.resSubdirScalaRR}/$name-out${Props.scalaMajorVer}.js"
5555
var utestOutput = () : Any
5656

5757
Babel.normaliseToFile(actualFilename, tempFilename)

library/testEmissions/jvm/src/test/scala/japgolly/scalajs/react/test/emissions/util/Props.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ object Props {
1010

1111
val CI = Prop.get("CI").contains("1")
1212
val jsOutputDir = Prop.need("jsOutputDir")
13+
val scalaVer = Prop.need("scalaVer")
1314
val tempDir = Prop.need("tempDir")
1415
val testResDir = Prop.need("testResDir")
1516
val testRootDir = Prop.need("testRootDir")
1617

18+
val scalaMajorVer = scalaVer.takeWhile(_.isDigit).toInt
19+
1720
// -------------------------------------------------------------------------------------------------------------------
1821

1922
private object Prop {

0 commit comments

Comments
 (0)