@@ -36,11 +36,12 @@ describe('findEntrypoints', () => {
36
36
outDir : resolve ( '.output' ) ,
37
37
command : 'build' ,
38
38
} ) ;
39
- let importEntrypointMock : Mock ;
39
+ let importEntrypointsMock : Mock < typeof wxt . builder . importEntrypoints > ;
40
40
41
41
beforeEach ( ( ) => {
42
42
setFakeWxt ( { config } ) ;
43
- importEntrypointMock = vi . mocked ( wxt . builder . importEntrypoint ) ;
43
+ importEntrypointsMock = vi . mocked ( wxt . builder . importEntrypoints ) ;
44
+ importEntrypointsMock . mockResolvedValue ( [ ] ) ;
44
45
} ) ;
45
46
46
47
it . each < [ string , string , PopupEntrypoint ] > ( [
@@ -210,13 +211,13 @@ describe('findEntrypoints', () => {
210
211
matches : [ '<all_urls>' ] ,
211
212
} ;
212
213
globMock . mockResolvedValueOnce ( [ path ] ) ;
213
- importEntrypointMock . mockResolvedValue ( options ) ;
214
+ importEntrypointsMock . mockResolvedValue ( [ options ] ) ;
214
215
215
216
const entrypoints = await findEntrypoints ( ) ;
216
217
217
218
expect ( entrypoints ) . toHaveLength ( 1 ) ;
218
219
expect ( entrypoints [ 0 ] ) . toEqual ( { ...expected , options } ) ;
219
- expect ( importEntrypointMock ) . toBeCalledWith ( expected . inputPath ) ;
220
+ expect ( importEntrypointsMock ) . toBeCalledWith ( [ expected . inputPath ] ) ;
220
221
} ,
221
222
) ;
222
223
@@ -244,17 +245,17 @@ describe('findEntrypoints', () => {
244
245
] ) (
245
246
'should find and load background entrypoint config from %s' ,
246
247
async ( path , expected ) => {
247
- const options : BackgroundEntrypointOptions = {
248
+ const options = {
248
249
type : 'module' ,
249
- } ;
250
+ } satisfies BackgroundEntrypointOptions ;
250
251
globMock . mockResolvedValueOnce ( [ path ] ) ;
251
- importEntrypointMock . mockResolvedValue ( options ) ;
252
+ importEntrypointsMock . mockResolvedValue ( [ options ] ) ;
252
253
253
254
const entrypoints = await findEntrypoints ( ) ;
254
255
255
256
expect ( entrypoints ) . toHaveLength ( 1 ) ;
256
257
expect ( entrypoints [ 0 ] ) . toEqual ( { ...expected , options } ) ;
257
- expect ( importEntrypointMock ) . toBeCalledWith ( expected . inputPath ) ;
258
+ expect ( importEntrypointsMock ) . toBeCalledWith ( [ expected . inputPath ] ) ;
258
259
} ,
259
260
) ;
260
261
@@ -339,11 +340,11 @@ describe('findEntrypoints', () => {
339
340
} ,
340
341
builder : wxt . builder ,
341
342
} ) ;
342
- const options : BackgroundEntrypointOptions = {
343
+ const options = {
343
344
type : 'module' ,
344
- } ;
345
+ } satisfies BackgroundEntrypointOptions ;
345
346
globMock . mockResolvedValueOnce ( [ 'background.ts' ] ) ;
346
- importEntrypointMock . mockResolvedValue ( options ) ;
347
+ importEntrypointsMock . mockResolvedValue ( [ options ] ) ;
347
348
348
349
const entrypoints = await findEntrypoints ( ) ;
349
350
@@ -357,11 +358,11 @@ describe('findEntrypoints', () => {
357
358
} ,
358
359
builder : wxt . builder ,
359
360
} ) ;
360
- const options : BackgroundEntrypointOptions = {
361
+ const options = {
361
362
type : 'module' ,
362
- } ;
363
+ } satisfies BackgroundEntrypointOptions ;
363
364
globMock . mockResolvedValueOnce ( [ 'background.ts' ] ) ;
364
- importEntrypointMock . mockResolvedValue ( options ) ;
365
+ importEntrypointsMock . mockResolvedValue ( [ options ] ) ;
365
366
366
367
const entrypoints = await findEntrypoints ( ) ;
367
368
@@ -410,15 +411,15 @@ describe('findEntrypoints', () => {
410
411
outputDir : config . outDir ,
411
412
skipped : false ,
412
413
} ;
413
- const options : BaseEntrypointOptions = { } ;
414
+ const options = { } satisfies BaseEntrypointOptions ;
414
415
globMock . mockResolvedValueOnce ( [ path ] ) ;
415
- importEntrypointMock . mockResolvedValue ( options ) ;
416
+ importEntrypointsMock . mockResolvedValue ( [ options ] ) ;
416
417
417
418
const entrypoints = await findEntrypoints ( ) ;
418
419
419
420
expect ( entrypoints ) . toHaveLength ( 1 ) ;
420
421
expect ( entrypoints [ 0 ] ) . toEqual ( { ...expected , options } ) ;
421
- expect ( importEntrypointMock ) . toBeCalledWith ( expected . inputPath ) ;
422
+ expect ( importEntrypointsMock ) . toBeCalledWith ( [ expected . inputPath ] ) ;
422
423
} ,
423
424
) ;
424
425
@@ -703,9 +704,9 @@ describe('findEntrypoints', () => {
703
704
describe ( 'include option' , ( ) => {
704
705
it ( "should mark the background as skipped when include doesn't contain the target browser" , async ( ) => {
705
706
globMock . mockResolvedValueOnce ( [ 'background.ts' ] ) ;
706
- importEntrypointMock . mockResolvedValue ( {
707
- include : [ 'not' + config . browser ] ,
708
- } ) ;
707
+ importEntrypointsMock . mockResolvedValue ( [
708
+ { include : [ 'not' + config . browser ] } ,
709
+ ] ) ;
709
710
710
711
const entrypoints = await findEntrypoints ( ) ;
711
712
@@ -719,9 +720,9 @@ describe('findEntrypoints', () => {
719
720
720
721
it ( "should mark content scripts as skipped when include doesn't contain the target browser" , async ( ) => {
721
722
globMock . mockResolvedValueOnce ( [ 'example.content.ts' ] ) ;
722
- importEntrypointMock . mockResolvedValue ( {
723
- include : [ 'not' + config . browser ] ,
724
- } ) ;
723
+ importEntrypointsMock . mockResolvedValue ( [
724
+ { include : [ 'not' + config . browser ] } ,
725
+ ] ) ;
725
726
726
727
const entrypoints = await findEntrypoints ( ) ;
727
728
@@ -803,9 +804,7 @@ describe('findEntrypoints', () => {
803
804
describe ( 'exclude option' , ( ) => {
804
805
it ( 'should mark the background as skipped when exclude contains the target browser' , async ( ) => {
805
806
globMock . mockResolvedValueOnce ( [ 'background.ts' ] ) ;
806
- importEntrypointMock . mockResolvedValue ( {
807
- exclude : [ config . browser ] ,
808
- } ) ;
807
+ importEntrypointsMock . mockResolvedValue ( [ { exclude : [ config . browser ] } ] ) ;
809
808
810
809
const entrypoints = await findEntrypoints ( ) ;
811
810
@@ -819,9 +818,7 @@ describe('findEntrypoints', () => {
819
818
820
819
it ( 'should mark content scripts as skipped when exclude contains the target browser' , async ( ) => {
821
820
globMock . mockResolvedValueOnce ( [ 'example.content.ts' ] ) ;
822
- importEntrypointMock . mockResolvedValue ( {
823
- exclude : [ config . browser ] ,
824
- } ) ;
821
+ importEntrypointsMock . mockResolvedValue ( [ { exclude : [ config . browser ] } ] ) ;
825
822
826
823
const entrypoints = await findEntrypoints ( ) ;
827
824
@@ -914,7 +911,7 @@ describe('findEntrypoints', () => {
914
911
builder : wxt . builder ,
915
912
} ) ;
916
913
917
- importEntrypointMock . mockResolvedValue ( { } ) ;
914
+ importEntrypointsMock . mockResolvedValue ( [ { } ] ) ;
918
915
919
916
const entrypoints = await findEntrypoints ( ) ;
920
917
0 commit comments