@@ -24,6 +24,8 @@ function getDefaultArgv() {
24
24
"sapCspPolicies" : false ,
25
25
"serve-csp-reports" : false ,
26
26
"serveCspReports" : false ,
27
+ "cache-mode" : "Default" ,
28
+ "cacheMode" : "Default" ,
27
29
"$0" : "ui5"
28
30
} ;
29
31
}
@@ -87,6 +89,7 @@ test.serial("ui5 serve: default", async (t) => {
87
89
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
88
90
rootConfigPath : undefined , versionOverride : undefined ,
89
91
workspaceConfigPath : undefined , workspaceName : undefined ,
92
+ cacheMode : "Default" ,
90
93
} ] ) ;
91
94
92
95
t . is ( t . context . consoleOutput , `Server started
@@ -132,6 +135,7 @@ test.serial("ui5 serve --h2", async (t) => {
132
135
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
133
136
rootConfigPath : undefined , versionOverride : undefined ,
134
137
workspaceConfigPath : undefined , workspaceName : undefined ,
138
+ cacheMode : "Default" ,
135
139
} ] ) ;
136
140
137
141
t . is ( t . context . consoleOutput , `Server started
@@ -173,6 +177,7 @@ test.serial("ui5 serve --accept-remote-connections", async (t) => {
173
177
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
174
178
rootConfigPath : undefined , versionOverride : undefined ,
175
179
workspaceConfigPath : undefined , workspaceName : undefined ,
180
+ cacheMode : "Default" ,
176
181
} ] ) ;
177
182
178
183
t . is ( t . context . consoleOutput , `
@@ -216,6 +221,7 @@ test.serial("ui5 serve --open", async (t) => {
216
221
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
217
222
rootConfigPath : undefined , versionOverride : undefined ,
218
223
workspaceConfigPath : undefined , workspaceName : undefined ,
224
+ cacheMode : "Default" ,
219
225
} ] ) ;
220
226
221
227
t . is ( t . context . consoleOutput , `Server started
@@ -256,6 +262,7 @@ test.serial("ui5 serve --open (opens default url)", async (t) => {
256
262
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
257
263
rootConfigPath : undefined , versionOverride : undefined ,
258
264
workspaceConfigPath : undefined , workspaceName : undefined ,
265
+ cacheMode : "Default" ,
259
266
} ] ) ;
260
267
261
268
t . is ( t . context . consoleOutput , `Server started
@@ -297,6 +304,7 @@ test.serial("ui5 serve --config", async (t) => {
297
304
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
298
305
rootConfigPath : fakePath , versionOverride : undefined ,
299
306
workspaceConfigPath : undefined , workspaceName : undefined ,
307
+ cacheMode : "Default" ,
300
308
} ] ) ;
301
309
302
310
t . is ( t . context . consoleOutput , `Server started
@@ -332,6 +340,7 @@ test.serial("ui5 serve --dependency-definition", async (t) => {
332
340
t . is ( graph . graphFromStaticFile . callCount , 1 ) ;
333
341
t . deepEqual ( graph . graphFromStaticFile . getCall ( 0 ) . args , [ {
334
342
filePath : fakePath , versionOverride : undefined ,
343
+ cacheMode : "Default" ,
335
344
} ] ) ;
336
345
337
346
t . is ( t . context . consoleOutput , `Server started
@@ -367,6 +376,43 @@ test.serial("ui5 serve --framework-version", async (t) => {
367
376
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
368
377
rootConfigPath : undefined , versionOverride : "1.234.5" ,
369
378
workspaceConfigPath : undefined , workspaceName : undefined ,
379
+ cacheMode : "Default" ,
380
+ } ] ) ;
381
+
382
+ t . is ( t . context . consoleOutput , `Server started
383
+ URL: http://localhost:8080
384
+ ` ) ;
385
+
386
+ t . is ( server . serve . callCount , 1 ) ;
387
+ t . deepEqual ( server . serve . getCall ( 0 ) . args , [
388
+ fakeGraph ,
389
+ {
390
+ acceptRemoteConnections : false ,
391
+ cert : undefined ,
392
+ changePortIfInUse : true ,
393
+ h2 : false ,
394
+ key : undefined ,
395
+ port : 8080 ,
396
+ sendSAPTargetCSP : false ,
397
+ serveCSPReports : false ,
398
+ simpleIndex : false ,
399
+ }
400
+ ] ) ;
401
+ } ) ;
402
+
403
+ test . serial ( "ui5 serve --cache-mode" , async ( t ) => {
404
+ const { argv, serve, graph, server, fakeGraph} = t . context ;
405
+
406
+ argv . cacheMode = "Force" ;
407
+
408
+ await serve . handler ( argv ) ;
409
+
410
+ t . is ( graph . graphFromStaticFile . callCount , 0 ) ;
411
+ t . is ( graph . graphFromPackageDependencies . callCount , 1 ) ;
412
+ t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
413
+ rootConfigPath : undefined , versionOverride : undefined ,
414
+ workspaceConfigPath : undefined , workspaceName : undefined ,
415
+ cacheMode : "Force" ,
370
416
} ] ) ;
371
417
372
418
t . is ( t . context . consoleOutput , `Server started
@@ -402,6 +448,7 @@ test.serial("ui5 serve --workspace", async (t) => {
402
448
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
403
449
rootConfigPath : undefined , versionOverride : undefined ,
404
450
workspaceConfigPath : undefined , workspaceName : "dolphin" ,
451
+ cacheMode : "Default" ,
405
452
} ] ) ;
406
453
407
454
t . is ( t . context . consoleOutput , `Server started
@@ -437,6 +484,7 @@ test.serial("ui5 serve --no-workspace", async (t) => {
437
484
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
438
485
rootConfigPath : undefined , versionOverride : undefined ,
439
486
workspaceConfigPath : undefined , workspaceName : null ,
487
+ cacheMode : "Default" ,
440
488
} ] ) ;
441
489
442
490
t . is ( t . context . consoleOutput , `Server started
@@ -473,6 +521,7 @@ test.serial("ui5 serve --workspace-config", async (t) => {
473
521
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
474
522
rootConfigPath : undefined , versionOverride : undefined ,
475
523
workspaceConfigPath : fakePath , workspaceName : undefined ,
524
+ cacheMode : "Default" ,
476
525
} ] ) ;
477
526
478
527
t . is ( t . context . consoleOutput , `Server started
@@ -508,6 +557,7 @@ test.serial("ui5 serve --sap-csp-policies", async (t) => {
508
557
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
509
558
rootConfigPath : undefined , versionOverride : undefined ,
510
559
workspaceConfigPath : undefined , workspaceName : undefined ,
560
+ cacheMode : "Default" ,
511
561
} ] ) ;
512
562
513
563
t . is ( t . context . consoleOutput , `Server started
@@ -543,6 +593,7 @@ test.serial("ui5 serve --serve-csp-reports", async (t) => {
543
593
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
544
594
rootConfigPath : undefined , versionOverride : undefined ,
545
595
workspaceConfigPath : undefined , workspaceName : undefined ,
596
+ cacheMode : "Default" ,
546
597
} ] ) ;
547
598
548
599
t . is ( t . context . consoleOutput , `Server started
@@ -578,6 +629,7 @@ test.serial("ui5 serve --simple-index", async (t) => {
578
629
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
579
630
rootConfigPath : undefined , versionOverride : undefined ,
580
631
workspaceConfigPath : undefined , workspaceName : undefined ,
632
+ cacheMode : "Default" ,
581
633
} ] ) ;
582
634
583
635
t . is ( t . context . consoleOutput , `Server started
@@ -620,6 +672,7 @@ test.serial("ui5 serve with ui5.yaml port setting", async (t) => {
620
672
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
621
673
rootConfigPath : undefined , versionOverride : undefined ,
622
674
workspaceConfigPath : undefined , workspaceName : undefined ,
675
+ cacheMode : "Default" ,
623
676
} ] ) ;
624
677
625
678
t . is ( t . context . consoleOutput , `Server started
@@ -669,6 +722,7 @@ test.serial("ui5 serve --h2 with ui5.yaml port setting", async (t) => {
669
722
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
670
723
rootConfigPath : undefined , versionOverride : undefined ,
671
724
workspaceConfigPath : undefined , workspaceName : undefined ,
725
+ cacheMode : "Default" ,
672
726
} ] ) ;
673
727
674
728
t . is ( t . context . consoleOutput , `Server started
@@ -725,6 +779,7 @@ test.serial("ui5 serve --h2 with ui5.yaml port setting and port CLI argument", a
725
779
t . deepEqual ( graph . graphFromPackageDependencies . getCall ( 0 ) . args , [ {
726
780
rootConfigPath : undefined , versionOverride : undefined ,
727
781
workspaceConfigPath : undefined , workspaceName : undefined ,
782
+ cacheMode : "Default" ,
728
783
} ] ) ;
729
784
730
785
t . is ( t . context . consoleOutput , `Server started
0 commit comments