@@ -77,7 +77,7 @@ async function createRsbuildWithMiddleware(
77
77
options : PluginAssetsRetryOptions ,
78
78
entry ?: string ,
79
79
port ?: number ,
80
- assetPrefix ?: string
80
+ assetPrefix ?: string ,
81
81
) {
82
82
const rsbuild = await dev ( {
83
83
cwd : __dirname ,
@@ -94,9 +94,11 @@ async function createRsbuildWithMiddleware(
94
94
middlewares . unshift ( ...addMiddleWares ) ;
95
95
} ,
96
96
] ,
97
- ...( assetPrefix ? {
98
- assetPrefix
99
- } : { } )
97
+ ...( assetPrefix
98
+ ? {
99
+ assetPrefix,
100
+ }
101
+ : { } ) ,
100
102
} ,
101
103
...( port
102
104
? {
@@ -111,10 +113,7 @@ async function createRsbuildWithMiddleware(
111
113
}
112
114
: { } ) ,
113
115
output : {
114
- sourceMap : {
115
- css : false ,
116
- js : false ,
117
- } ,
116
+ sourceMap : false ,
118
117
} ,
119
118
} ,
120
119
} ) ;
@@ -465,7 +464,11 @@ test('domain, onRetry and onFail options should work when retrying initial chunk
465
464
blockedMiddleware ,
466
465
{
467
466
minify : true ,
468
- domain : [ `http://localhost:${ port } ` , 'http://a.com/foo-path' , 'http://b.com' ] ,
467
+ domain : [
468
+ `http://localhost:${ port } ` ,
469
+ 'http://a.com/foo-path' ,
470
+ 'http://b.com' ,
471
+ ] ,
469
472
onRetry ( context ) {
470
473
console . info ( 'onRetry' , context ) ;
471
474
} ,
@@ -541,7 +544,11 @@ test('domain, onRetry and onFail options should work when retrying async chunk f
541
544
blockedMiddleware ,
542
545
{
543
546
minify : true ,
544
- domain : [ `http://localhost:${ port } ` , 'http://a.com/foo-path' , 'http://b.com' ] ,
547
+ domain : [
548
+ `http://localhost:${ port } ` ,
549
+ 'http://a.com/foo-path' ,
550
+ 'http://b.com' ,
551
+ ] ,
545
552
onRetry ( context ) {
546
553
console . info ( 'onRetry' , context ) ;
547
554
} ,
@@ -659,7 +666,9 @@ test('should work with addQuery boolean option', async ({ page }) => {
659
666
logger . level = 'log' ;
660
667
} ) ;
661
668
662
- test ( 'should work with addQuery boolean option when retrying async css chunk' , async ( { page } ) => {
669
+ test ( 'should work with addQuery boolean option when retrying async css chunk' , async ( {
670
+ page,
671
+ } ) => {
663
672
logger . level = 'verbose' ;
664
673
const { logs, restore } = proxyConsole ( ) ;
665
674
@@ -678,7 +687,10 @@ test('should work with addQuery boolean option when retrying async css chunk', a
678
687
await gotoPage ( page , rsbuild ) ;
679
688
const asyncCompTestElement = page . locator ( '#async-comp-test' ) ;
680
689
await expect ( asyncCompTestElement ) . toHaveText ( 'Hello AsyncCompTest' ) ;
681
- await expect ( asyncCompTestElement ) . toHaveCSS ( 'background-color' , 'rgb(0, 0, 139)' ) ;
690
+ await expect ( asyncCompTestElement ) . toHaveCSS (
691
+ 'background-color' ,
692
+ 'rgb(0, 0, 139)' ,
693
+ ) ;
682
694
683
695
const blockedAsyncChunkResponseCount = count404ResponseByUrl (
684
696
logs ,
@@ -901,14 +913,20 @@ test('onRetry and onFail options should work when multiple parallel retrying asy
901
913
await rsbuild . close ( ) ;
902
914
} ) ;
903
915
904
- test ( 'should work when the first, second cdn are all failed and the third is success' , async ( { page } ) => {
916
+ test ( 'should work when the first, second cdn are all failed and the third is success' , async ( {
917
+ page,
918
+ } ) => {
905
919
// this is a real world case for assets-retry
906
920
const port = await getRandomPort ( ) ;
907
921
const rsbuild = await createRsbuildWithMiddleware (
908
922
[ ] ,
909
923
{
910
924
minify : true ,
911
- domain : [ 'http://a.com/foo-path' , 'http://b.com' , `http://localhost:${ port } ` ] ,
925
+ domain : [
926
+ 'http://a.com/foo-path' ,
927
+ 'http://b.com' ,
928
+ `http://localhost:${ port } ` ,
929
+ ] ,
912
930
addQuery : true ,
913
931
onRetry ( context ) {
914
932
console . info ( 'onRetry' , context ) ;
@@ -922,11 +940,11 @@ test('should work when the first, second cdn are all failed and the third is suc
922
940
} ,
923
941
undefined ,
924
942
port ,
925
- 'http://a.com/foo-path'
943
+ 'http://a.com/foo-path' ,
926
944
) ;
927
945
928
946
await gotoPage ( page , rsbuild ) ;
929
947
const compTestElement = page . locator ( '#async-comp-test' ) ;
930
948
await expect ( compTestElement ) . toHaveText ( 'Hello AsyncCompTest' ) ;
931
949
await expect ( compTestElement ) . toHaveCSS ( 'background-color' , 'rgb(0, 0, 139)' ) ;
932
- } )
950
+ } ) ;
0 commit comments