@@ -57,6 +57,11 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
5757 js : [ "src/app.js" ] ,
5858 modules : [ "node_modules/react" ] ,
5959 } ;
60+ const mockEmptyDependencies = {
61+ css : [ ] ,
62+ js : [ ] ,
63+ modules : [ ] ,
64+ } ;
6065
6166 it ( "should create directory on first save" , async ( ) => {
6267 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
@@ -79,10 +84,10 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
7984 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
8085 readJsonWithCompression . resolves ( { } ) ;
8186
82- await writer . saveFor ( mockTest , mockDependencies ) ;
87+ await writer . saveFor ( mockTest , mockDependencies , mockEmptyDependencies ) ;
8388
8489 const expectedPath = "/test/selectivity/tests/test-123.json" ;
85- const expectedContent = { chrome : { browser : mockDependencies } } ;
90+ const expectedContent = { chrome : { browser : mockDependencies , testplane : mockEmptyDependencies } } ;
8691
8792 assert . calledWith ( pathStub . join , "/test/selectivity/tests" , "test-123.json" ) ;
8893 assert . calledWith ( writeJsonWithCompression , expectedPath , expectedContent ) ;
@@ -97,11 +102,11 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
97102
98103 readJsonWithCompression . resolves ( existingContent ) ;
99104
100- await writer . saveFor ( mockTest , mockDependencies ) ;
105+ await writer . saveFor ( mockTest , mockDependencies , mockEmptyDependencies ) ;
101106
102107 const expectedContent = {
103108 firefox : { browser : { css : [ "old.css" ] , js : [ ] , modules : [ ] } } ,
104- chrome : { browser : mockDependencies } ,
109+ chrome : { browser : mockDependencies , testplane : mockEmptyDependencies } ,
105110 } ;
106111
107112 assert . calledWith ( writeJsonWithCompression , "/test/selectivity/tests/test-123.json" , expectedContent ) ;
@@ -110,12 +115,12 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
110115 it ( "should not save if dependencies are the same" , async ( ) => {
111116 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
112117 const existingContent = {
113- chrome : { browser : mockDependencies } ,
118+ chrome : { browser : mockDependencies , testplane : mockEmptyDependencies } ,
114119 } ;
115120
116121 readJsonWithCompression . resolves ( existingContent ) ;
117122
118- await writer . saveFor ( mockTest , mockDependencies ) ;
123+ await writer . saveFor ( mockTest , mockDependencies , mockEmptyDependencies ) ;
119124
120125 assert . notCalled ( writeJsonWithCompression ) ;
121126 } ) ;
@@ -124,9 +129,9 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
124129 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
125130 readJsonWithCompression . rejects ( new Error ( "invalid json" ) ) ;
126131
127- await writer . saveFor ( mockTest , mockDependencies ) ;
132+ await writer . saveFor ( mockTest , mockDependencies , mockEmptyDependencies ) ;
128133
129- const expectedContent = { chrome : { browser : mockDependencies } } ;
134+ const expectedContent = { chrome : { browser : mockDependencies , testplane : mockEmptyDependencies } } ;
130135
131136 assert . calledWith ( writeJsonWithCompression , "/test/selectivity/tests/test-123.json" , expectedContent ) ;
132137 } ) ;
@@ -135,24 +140,24 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
135140 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
136141 readJsonWithCompression . resolves ( { } ) ;
137142
138- await writer . saveFor ( mockTest , mockDependencies ) ;
143+ await writer . saveFor ( mockTest , mockDependencies , mockEmptyDependencies ) ;
139144
140- const expectedContent = { chrome : { browser : mockDependencies } } ;
145+ const expectedContent = { chrome : { browser : mockDependencies , testplane : mockEmptyDependencies } } ;
141146
142147 assert . calledWith ( writeJsonWithCompression , "/test/selectivity/tests/test-123.json" , expectedContent ) ;
143148 } ) ;
144149
145150 it ( "should overwrite existing browser dependencies" , async ( ) => {
146151 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
147152 const existingContent = {
148- chrome : { browser : { css : [ "old.css" ] , js : [ ] , modules : [ ] } } ,
153+ chrome : { browser : { css : [ "old.css" ] , js : [ ] , modules : [ ] } , testplane : mockEmptyDependencies } ,
149154 } ;
150155
151156 readJsonWithCompression . resolves ( existingContent ) ;
152157
153- await writer . saveFor ( mockTest , mockDependencies ) ;
158+ await writer . saveFor ( mockTest , mockDependencies , mockEmptyDependencies ) ;
154159
155- const expectedContent = { chrome : { browser : mockDependencies } } ;
160+ const expectedContent = { chrome : { browser : mockDependencies , testplane : mockEmptyDependencies } } ;
156161
157162 assert . calledWith ( writeJsonWithCompression , "/test/selectivity/tests/test-123.json" , expectedContent ) ;
158163 } ) ;
@@ -172,11 +177,11 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
172177 } ;
173178
174179 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
175- const existingContent = { chrome : { browser : deps1 } } ;
180+ const existingContent = { chrome : { browser : deps1 , testplane : deps1 } } ;
176181
177182 readJsonWithCompression . resolves ( existingContent ) ;
178183
179- return writer . saveFor ( { id : "test" , browserId : "chrome" } , deps2 ) . then ( ( ) => {
184+ return writer . saveFor ( { id : "test" , browserId : "chrome" } , deps2 , deps2 ) . then ( ( ) => {
180185 assert . notCalled ( writeJsonWithCompression ) ;
181186 } ) ;
182187 } ) ;
@@ -194,11 +199,11 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
194199 } ;
195200
196201 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
197- const existingContent = { chrome : { browser : deps1 } } ;
202+ const existingContent = { chrome : { browser : deps1 , testplane : deps2 } } ;
198203
199204 readJsonWithCompression . resolves ( existingContent ) ;
200205
201- await writer . saveFor ( { id : "test" , browserId : "chrome" } , deps2 ) ;
206+ await writer . saveFor ( { id : "test" , browserId : "chrome" } , deps2 , deps2 ) ;
202207
203208 assert . calledOnce ( writeJsonWithCompression ) ;
204209 } ) ;
@@ -213,7 +218,7 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
213218 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
214219 readJsonWithCompression . resolves ( { } ) ;
215220
216- await writer . saveFor ( { id : "test" , browserId : "chrome" } , deps ) ;
221+ await writer . saveFor ( { id : "test" , browserId : "chrome" } , deps , deps ) ;
217222
218223 assert . calledOnce ( writeJsonWithCompression ) ;
219224 } ) ;
@@ -231,11 +236,11 @@ describe("CDP/Selectivity/TestDependenciesWriter", () => {
231236 } ;
232237
233238 const writer = new TestDependenciesWriter ( "/test/selectivity" , "none" ) ;
234- const existingContent = { chrome : { browser : deps1 } } ;
239+ const existingContent = { chrome : { browser : deps1 , testplane : deps1 } } ;
235240
236241 readJsonWithCompression . resolves ( existingContent ) ;
237242
238- await writer . saveFor ( { id : "test" , browserId : "chrome" } , deps2 ) ;
243+ await writer . saveFor ( { id : "test" , browserId : "chrome" } , deps2 , deps2 ) ;
239244
240245 assert . calledOnce ( writeJsonWithCompression ) ;
241246 } ) ;
0 commit comments