@@ -15,6 +15,8 @@ import {
1515
1616import devupUICssLoader , { resetInit } from '../css-loader'
1717
18+ type CssLoaderThis = ThisParameterType < typeof devupUICssLoader >
19+
1820let getCssSpy : ReturnType < typeof spyOn >
1921let registerThemeSpy : ReturnType < typeof spyOn >
2022let importSheetSpy : ReturnType < typeof spyOn >
@@ -75,7 +77,7 @@ describe('devupUICssLoader', () => {
7577 addContextDependency,
7678 resourcePath : 'devup-ui.css' ,
7779 getOptions : ( ) => ( { ...defaultOptions , watch : false } ) ,
78- } as any ) ( Buffer . from ( 'data' ) , '' )
80+ } as unknown as CssLoaderThis ) ( Buffer . from ( 'data' ) , '' )
7981 expect ( callback ) . toHaveBeenCalledWith (
8082 null ,
8183 Buffer . from ( 'data' ) ,
@@ -97,7 +99,7 @@ describe('devupUICssLoader', () => {
9799 addContextDependency,
98100 getOptions : ( ) => ( { ...defaultOptions , watch : true } ) ,
99101 resourcePath : 'devup-ui.css' ,
100- } as any ) ( Buffer . from ( 'data' ) , '' )
102+ } as unknown as CssLoaderThis ) ( Buffer . from ( 'data' ) , '' )
101103 expect ( callback ) . toHaveBeenCalledTimes ( 1 )
102104 expect ( getCssSpy ) . toHaveBeenCalledTimes ( 1 )
103105 getCssSpy . mockClear ( )
@@ -106,7 +108,7 @@ describe('devupUICssLoader', () => {
106108 addContextDependency,
107109 getOptions : ( ) => ( { ...defaultOptions , watch : true } ) ,
108110 resourcePath : 'devup-ui.css' ,
109- } as any ) ( Buffer . from ( 'data' ) , '' )
111+ } as unknown as CssLoaderThis ) ( Buffer . from ( 'data' ) , '' )
110112
111113 expect ( getCssSpy ) . toHaveBeenCalledTimes ( 1 )
112114
@@ -117,7 +119,7 @@ describe('devupUICssLoader', () => {
117119 addContextDependency,
118120 getOptions : ( ) => ( { ...defaultOptions , watch : true } ) ,
119121 resourcePath : 'devup-ui-10.css' ,
120- } as any ) ( Buffer . from ( '' ) , '' )
122+ } as unknown as CssLoaderThis ) ( Buffer . from ( '' ) , '' )
121123
122124 expect ( getCssSpy ) . toHaveBeenCalledTimes ( 1 )
123125 } )
@@ -133,7 +135,7 @@ describe('devupUICssLoader', () => {
133135 addContextDependency,
134136 getOptions : ( ) => ( { ...defaultOptions , watch : true } ) ,
135137 resourcePath : 'devup-ui.css' ,
136- } as any ) ( Buffer . from ( 'data' ) , '' )
138+ } as unknown as CssLoaderThis ) ( Buffer . from ( 'data' ) , '' )
137139
138140 // Should read files from disk
139141 expect ( existsSyncSpy ) . toHaveBeenCalledTimes ( 4 )
@@ -155,7 +157,7 @@ describe('devupUICssLoader', () => {
155157 addContextDependency,
156158 getOptions : ( ) => ( { ...defaultOptions , watch : true } ) ,
157159 resourcePath : 'devup-ui.css' ,
158- } as any ) ( Buffer . from ( 'data' ) , '' )
160+ } as unknown as CssLoaderThis ) ( Buffer . from ( 'data' ) , '' )
159161
160162 // Should call registerTheme with empty object when theme is missing
161163 expect ( registerThemeSpy ) . toHaveBeenCalledWith ( { } )
@@ -190,7 +192,11 @@ describe('devupUICssLoader', () => {
190192 coordinatorPortFile : portFile ,
191193 } ) ,
192194 resourcePath : 'devup-ui-1.css' ,
193- } as any ) ( Buffer . from ( 'stale content' ) , 'existing-map' , 'meta' )
195+ } as unknown as CssLoaderThis ) (
196+ Buffer . from ( 'stale content' ) ,
197+ 'existing-map' ,
198+ 'meta' ,
199+ )
194200 } )
195201
196202 expect ( result ) . toBe ( '.a{color:red}' )
@@ -235,7 +241,7 @@ describe('devupUICssLoader', () => {
235241 coordinatorPortFile : portFile ,
236242 } ) ,
237243 resourcePath : 'devup-ui.css' ,
238- } as any ) ( Buffer . from ( 'stale' ) , '' , '' )
244+ } as unknown as CssLoaderThis ) ( Buffer . from ( 'stale' ) , '' , '' )
239245 } )
240246
241247 expect ( result ) . toBe ( '.full{display:flex}' )
@@ -278,7 +284,11 @@ describe('devupUICssLoader', () => {
278284 } ) ,
279285 // Turbopack embeds query in resourcePath
280286 resourcePath : '/path/to/df/devup-ui/devup-ui.css?fileNum=79' ,
281- } as any ) ( Buffer . from ( 'stale content' ) , 'existing-map' , 'meta' )
287+ } as unknown as CssLoaderThis ) (
288+ Buffer . from ( 'stale content' ) ,
289+ 'existing-map' ,
290+ 'meta' ,
291+ )
282292 } )
283293
284294 expect ( result ) . toBe ( '.file79{color:blue}' )
@@ -320,7 +330,7 @@ describe('devupUICssLoader', () => {
320330 // resourcePath without query, query in separate property
321331 resourcePath : '/path/to/df/devup-ui/devup-ui.css' ,
322332 resourceQuery : '?fileNum=3' ,
323- } as any ) ( Buffer . from ( 'stale' ) , '' , '' )
333+ } as unknown as CssLoaderThis ) ( Buffer . from ( 'stale' ) , '' , '' )
324334 } )
325335
326336 expect ( result ) . toBe ( '.file3{color:green}' )
@@ -344,7 +354,7 @@ describe('devupUICssLoader', () => {
344354 coordinatorPortFile : 'nonexistent.port' ,
345355 } ) ,
346356 resourcePath : 'devup-ui.css' ,
347- } as any ) ( Buffer . from ( '' ) , '' , '' )
357+ } as unknown as CssLoaderThis ) ( Buffer . from ( '' ) , '' , '' )
348358 } )
349359
350360 expect ( error . message ) . toBe ( 'Coordinator port file not found' )
@@ -376,7 +386,7 @@ describe('devupUICssLoader', () => {
376386 coordinatorPortFile : portFile ,
377387 } ) ,
378388 resourcePath : 'devup-ui.css' ,
379- } as any ) ( Buffer . from ( '' ) , '' , '' )
389+ } as unknown as CssLoaderThis ) ( Buffer . from ( '' ) , '' , '' )
380390 } )
381391
382392 expect ( error . message ) . toBe ( 'Coordinator CSS error: 500' )
@@ -404,7 +414,7 @@ describe('devupUICssLoader', () => {
404414 coordinatorPortFile : portFile ,
405415 } ) ,
406416 resourcePath : 'devup-ui.css' ,
407- } as any ) ( Buffer . from ( '' ) , '' , '' )
417+ } as unknown as CssLoaderThis ) ( Buffer . from ( '' ) , '' , '' )
408418 } )
409419
410420 expect ( error . message ) . toBe ( 'EACCES: permission denied' )
@@ -431,7 +441,7 @@ describe('devupUICssLoader', () => {
431441 coordinatorPortFile : portFile ,
432442 } ) ,
433443 resourcePath : 'devup-ui.css' ,
434- } as any ) ( Buffer . from ( '' ) , '' , '' )
444+ } as unknown as CssLoaderThis ) ( Buffer . from ( '' ) , '' , '' )
435445 } )
436446
437447 expect ( error ) . toBeInstanceOf ( Error )
0 commit comments