@@ -437,7 +437,7 @@ class VaadinSmokeTest : AbstractGradleTest() {
437
437
addonJar.toPath(), StandardCopyOption .REPLACE_EXISTING
438
438
)
439
439
440
- val result: BuildResult = testProject.build(" -Pvaadin.productionMode" , " build" )
440
+ val result: BuildResult = testProject.build(" -Pvaadin.productionMode" , " build" , debug = true )
441
441
result.expectTaskSucceded(" vaadinPrepareFrontend" )
442
442
result.expectTaskSucceded(" vaadinBuildFrontend" )
443
443
@@ -497,6 +497,78 @@ class VaadinSmokeTest : AbstractGradleTest() {
497
497
}
498
498
}
499
499
500
+ @Test
501
+ fun testPrepareFrontend_configurationCache () {
502
+ // Create frontend folder, that will otherwise be created by the first
503
+ // execution of vaadinPrepareFrontend, invalidating the cache on the
504
+ // second run
505
+ testProject.newFolder(" src/main/frontend" )
506
+
507
+ val result = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" )
508
+ result.expectTaskSucceded(" vaadinPrepareFrontend" )
509
+ assertContains(result.output, " Calculating task graph as no cached configuration is available for tasks: vaadinPrepareFrontend" )
510
+ assertContains(result.output, " Configuration cache entry stored" )
511
+
512
+ val result2 = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" , checkTasksSuccessful = false )
513
+ result2.expectTaskOutcome(" vaadinPrepareFrontend" , TaskOutcome .UP_TO_DATE )
514
+ assertContains(result2.output, " Reusing configuration cache" )
515
+ }
516
+
517
+ @Test
518
+ fun testPrepareFrontend_configurationCache_configurationChange_cacheInvalidated () {
519
+ // Create frontend folder, that will otherwise be created by the first
520
+ // execution of vaadinPrepareFrontend, invalidating the cache on the
521
+ // second run
522
+ testProject.newFolder(" src/main/frontend" )
523
+
524
+ val result = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" )
525
+ result.expectTaskSucceded(" vaadinPrepareFrontend" )
526
+ assertContains(result.output, " Calculating task graph as no cached configuration is available for tasks: vaadinPrepareFrontend" )
527
+ assertContains(result.output, " Configuration cache entry stored" )
528
+
529
+ val buildFile = testProject.buildFile.readText()
530
+ .replace(" nodeAutoUpdate = true" , " nodeAutoUpdate = false" )
531
+ testProject.buildFile.writeText(buildFile)
532
+
533
+ val result2 = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" , checkTasksSuccessful = false )
534
+ result2.expectTaskOutcome(" vaadinPrepareFrontend" , TaskOutcome .SUCCESS )
535
+ assertContains(result.output, " Calculating task graph as no cached configuration is available for tasks: vaadinPrepareFrontend" )
536
+ }
537
+
538
+ @Test
539
+ fun testPrepareFrontend_configurationCache_gradlePropertyChange_cacheInvalidated () {
540
+ // Create frontend folder, that will otherwise be created by the first
541
+ // execution of vaadinPrepareFrontend, invalidating the cache on the
542
+ // second run
543
+ testProject.newFolder(" src/main/frontend" )
544
+
545
+ val result = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" )
546
+ result.expectTaskSucceded(" vaadinPrepareFrontend" )
547
+ assertContains(result.output, " Calculating task graph as no cached configuration is available for tasks: vaadinPrepareFrontend" )
548
+ assertContains(result.output, " Configuration cache entry stored" )
549
+
550
+ val result2 = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" , " -Pvaadin.eagerServerLoad=true" , checkTasksSuccessful = false )
551
+ result2.expectTaskOutcome(" vaadinPrepareFrontend" , TaskOutcome .SUCCESS )
552
+ assertContains(result.output, " Calculating task graph as no cached configuration is available for tasks: vaadinPrepareFrontend" )
553
+ }
554
+
555
+ @Test
556
+ fun testPrepareFrontend_configurationCache_systemPropertyChange_cacheInvalidated () {
557
+ // Create frontend folder, that will otherwise be created by the first
558
+ // execution of vaadinPrepareFrontend, invalidating the cache on the
559
+ // second run
560
+ testProject.newFolder(" src/main/frontend" )
561
+
562
+ val result = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" )
563
+ result.expectTaskSucceded(" vaadinPrepareFrontend" )
564
+ assertContains(result.output, " Calculating task graph as no cached configuration is available for tasks: vaadinPrepareFrontend" )
565
+ assertContains(result.output, " Configuration cache entry stored" )
566
+
567
+ val result2 = testProject.build(" --configuration-cache" , " vaadinPrepareFrontend" , " -Dvaadin.eagerServerLoad=true" , checkTasksSuccessful = false )
568
+ result2.expectTaskOutcome(" vaadinPrepareFrontend" , TaskOutcome .SUCCESS )
569
+ assertContains(result.output, " Calculating task graph as no cached configuration is available for tasks: vaadinPrepareFrontend" )
570
+ }
571
+
500
572
private fun enableHilla () {
501
573
testProject.newFolder(FrontendUtils .DEFAULT_FRONTEND_DIR )
502
574
testProject.newFile(FrontendUtils .DEFAULT_FRONTEND_DIR + " index.ts" )
0 commit comments