@@ -701,29 +701,39 @@ describe('findEntrypoints', () => {
701
701
} ) ;
702
702
703
703
describe ( 'include option' , ( ) => {
704
- it ( "should filter out the background when include doesn't contain the target browser" , async ( ) => {
704
+ it ( "should mark the background as skipped when include doesn't contain the target browser" , async ( ) => {
705
705
globMock . mockResolvedValueOnce ( [ 'background.ts' ] ) ;
706
706
importEntrypointMock . mockResolvedValue ( {
707
707
include : [ 'not' + config . browser ] ,
708
708
} ) ;
709
709
710
710
const entrypoints = await findEntrypoints ( ) ;
711
711
712
- expect ( entrypoints ) . toEqual ( [ ] ) ;
712
+ expect ( entrypoints ) . toEqual ( [
713
+ expect . objectContaining ( {
714
+ name : 'background' ,
715
+ skipped : true ,
716
+ } ) ,
717
+ ] ) ;
713
718
} ) ;
714
719
715
- it ( "should filter out content scripts when include doesn't contain the target browser" , async ( ) => {
720
+ it ( "should mark content scripts as skipped when include doesn't contain the target browser" , async ( ) => {
716
721
globMock . mockResolvedValueOnce ( [ 'example.content.ts' ] ) ;
717
722
importEntrypointMock . mockResolvedValue ( {
718
723
include : [ 'not' + config . browser ] ,
719
724
} ) ;
720
725
721
726
const entrypoints = await findEntrypoints ( ) ;
722
727
723
- expect ( entrypoints ) . toEqual ( [ ] ) ;
728
+ expect ( entrypoints ) . toEqual ( [
729
+ expect . objectContaining ( {
730
+ name : 'example' ,
731
+ skipped : true ,
732
+ } ) ,
733
+ ] ) ;
724
734
} ) ;
725
735
726
- it ( "should filter out the popup when include doesn't contain the target browser" , async ( ) => {
736
+ it ( "should mark the popup as skipped when include doesn't contain the target browser" , async ( ) => {
727
737
globMock . mockResolvedValueOnce ( [ 'popup.html' ] ) ;
728
738
readFileMock . mockResolvedValueOnce (
729
739
`<html>
@@ -737,10 +747,15 @@ describe('findEntrypoints', () => {
737
747
738
748
const entrypoints = await findEntrypoints ( ) ;
739
749
740
- expect ( entrypoints ) . toEqual ( [ ] ) ;
750
+ expect ( entrypoints ) . toEqual ( [
751
+ expect . objectContaining ( {
752
+ name : 'popup' ,
753
+ skipped : true ,
754
+ } ) ,
755
+ ] ) ;
741
756
} ) ;
742
757
743
- it ( "should filter out the options page when include doesn't contain the target browser" , async ( ) => {
758
+ it ( "should mark the options page as skipped when include doesn't contain the target browser" , async ( ) => {
744
759
globMock . mockResolvedValueOnce ( [ 'options.html' ] ) ;
745
760
readFileMock . mockResolvedValueOnce (
746
761
`<html>
@@ -754,10 +769,15 @@ describe('findEntrypoints', () => {
754
769
755
770
const entrypoints = await findEntrypoints ( ) ;
756
771
757
- expect ( entrypoints ) . toEqual ( [ ] ) ;
772
+ expect ( entrypoints ) . toEqual ( [
773
+ expect . objectContaining ( {
774
+ name : 'options' ,
775
+ skipped : true ,
776
+ } ) ,
777
+ ] ) ;
758
778
} ) ;
759
779
760
- it ( "should filter out an unlisted page when include doesn't contain the target browser" , async ( ) => {
780
+ it ( "should mark unlisted pages as skipped when include doesn't contain the target browser" , async ( ) => {
761
781
globMock . mockResolvedValueOnce ( [ 'unlisted.html' ] ) ;
762
782
readFileMock . mockResolvedValueOnce (
763
783
`<html>
@@ -771,34 +791,49 @@ describe('findEntrypoints', () => {
771
791
772
792
const entrypoints = await findEntrypoints ( ) ;
773
793
774
- expect ( entrypoints ) . toEqual ( [ ] ) ;
794
+ expect ( entrypoints ) . toEqual ( [
795
+ expect . objectContaining ( {
796
+ name : 'unlisted' ,
797
+ skipped : true ,
798
+ } ) ,
799
+ ] ) ;
775
800
} ) ;
776
801
} ) ;
777
802
778
803
describe ( 'exclude option' , ( ) => {
779
- it ( 'should filter out the background when exclude contains the target browser' , async ( ) => {
804
+ it ( 'should mark the background as skipped when exclude contains the target browser' , async ( ) => {
780
805
globMock . mockResolvedValueOnce ( [ 'background.ts' ] ) ;
781
806
importEntrypointMock . mockResolvedValue ( {
782
807
exclude : [ config . browser ] ,
783
808
} ) ;
784
809
785
810
const entrypoints = await findEntrypoints ( ) ;
786
811
787
- expect ( entrypoints ) . toEqual ( [ ] ) ;
812
+ expect ( entrypoints ) . toEqual ( [
813
+ expect . objectContaining ( {
814
+ name : 'background' ,
815
+ skipped : true ,
816
+ } ) ,
817
+ ] ) ;
788
818
} ) ;
789
819
790
- it ( 'should filter out content scripts when exclude contains the target browser' , async ( ) => {
820
+ it ( 'should mark content scripts as skipped when exclude contains the target browser' , async ( ) => {
791
821
globMock . mockResolvedValueOnce ( [ 'example.content.ts' ] ) ;
792
822
importEntrypointMock . mockResolvedValue ( {
793
823
exclude : [ config . browser ] ,
794
824
} ) ;
795
825
796
826
const entrypoints = await findEntrypoints ( ) ;
797
827
798
- expect ( entrypoints ) . toEqual ( [ ] ) ;
828
+ expect ( entrypoints ) . toEqual ( [
829
+ expect . objectContaining ( {
830
+ name : 'example' ,
831
+ skipped : true ,
832
+ } ) ,
833
+ ] ) ;
799
834
} ) ;
800
835
801
- it ( 'should filter out the popup when exclude contains the target browser' , async ( ) => {
836
+ it ( 'should mark the popup as skipped when exclude contains the target browser' , async ( ) => {
802
837
globMock . mockResolvedValueOnce ( [ 'popup.html' ] ) ;
803
838
readFileMock . mockResolvedValueOnce (
804
839
`<html>
@@ -810,10 +845,15 @@ describe('findEntrypoints', () => {
810
845
811
846
const entrypoints = await findEntrypoints ( ) ;
812
847
813
- expect ( entrypoints ) . toEqual ( [ ] ) ;
848
+ expect ( entrypoints ) . toEqual ( [
849
+ expect . objectContaining ( {
850
+ name : 'popup' ,
851
+ skipped : true ,
852
+ } ) ,
853
+ ] ) ;
814
854
} ) ;
815
855
816
- it ( 'should filter out the options page when exclude contains the target browser' , async ( ) => {
856
+ it ( 'should mark the options page as skipped when exclude contains the target browser' , async ( ) => {
817
857
globMock . mockResolvedValueOnce ( [ 'options.html' ] ) ;
818
858
readFileMock . mockResolvedValueOnce (
819
859
`<html>
@@ -825,10 +865,15 @@ describe('findEntrypoints', () => {
825
865
826
866
const entrypoints = await findEntrypoints ( ) ;
827
867
828
- expect ( entrypoints ) . toEqual ( [ ] ) ;
868
+ expect ( entrypoints ) . toEqual ( [
869
+ expect . objectContaining ( {
870
+ name : 'options' ,
871
+ skipped : true ,
872
+ } ) ,
873
+ ] ) ;
829
874
} ) ;
830
875
831
- it ( 'should filter out an unlisted page when exclude contains the target browser' , async ( ) => {
876
+ it ( 'should mark unlisted pages as skipped when exclude contains the target browser' , async ( ) => {
832
877
globMock . mockResolvedValueOnce ( [ 'unlisted.html' ] ) ;
833
878
readFileMock . mockResolvedValueOnce (
834
879
`<html>
@@ -840,12 +885,17 @@ describe('findEntrypoints', () => {
840
885
841
886
const entrypoints = await findEntrypoints ( ) ;
842
887
843
- expect ( entrypoints ) . toEqual ( [ ] ) ;
888
+ expect ( entrypoints ) . toEqual ( [
889
+ expect . objectContaining ( {
890
+ name : 'unlisted' ,
891
+ skipped : true ,
892
+ } ) ,
893
+ ] ) ;
844
894
} ) ;
845
895
} ) ;
846
896
847
897
describe ( 'filterEntrypoints option' , ( ) => {
848
- it ( 'should control entrypoints accessible ' , async ( ) => {
898
+ it ( 'should override include/exclude of individual entrypoint options ' , async ( ) => {
849
899
globMock . mockResolvedValue ( [
850
900
'options/index.html' ,
851
901
'popup/index.html' ,
@@ -867,9 +917,25 @@ describe('findEntrypoints', () => {
867
917
importEntrypointMock . mockResolvedValue ( { } ) ;
868
918
869
919
const entrypoints = await findEntrypoints ( ) ;
870
- const names = entrypoints . map ( ( item ) => item . name ) ;
871
- expect ( names ) . toHaveLength ( 2 ) ;
872
- expect ( names ) . toEqual ( filterEntrypoints ) ;
920
+
921
+ expect ( entrypoints ) . toEqual ( [
922
+ expect . objectContaining ( {
923
+ name : 'injected' ,
924
+ skipped : true ,
925
+ } ) ,
926
+ expect . objectContaining ( {
927
+ name : 'options' ,
928
+ skipped : true ,
929
+ } ) ,
930
+ expect . objectContaining ( {
931
+ name : 'popup' ,
932
+ skipped : false ,
933
+ } ) ,
934
+ expect . objectContaining ( {
935
+ name : 'ui' ,
936
+ skipped : false ,
937
+ } ) ,
938
+ ] ) ;
873
939
} ) ;
874
940
} ) ;
875
941
} ) ;
0 commit comments