@@ -69,7 +69,13 @@ describe(commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD, () => {
6969 sinon . stub ( command as any , 'getProjectRoot' ) . returns ( projectPath ) ;
7070
7171 sinon . stub ( fs , 'existsSync' ) . callsFake ( ( fakePath ) => {
72- if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' , 'pipelines' ) ) {
72+ if ( fakePath . toString ( ) === path . join ( projectPath , 'package.json' ) ) {
73+ return true ;
74+ }
75+ else if ( fakePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) ) {
76+ return true ;
77+ }
78+ else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' , 'pipelines' ) ) {
7379 return true ;
7480 }
7581
@@ -80,6 +86,9 @@ describe(commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD, () => {
8086 if ( fakePath . toString ( ) === path . join ( projectPath , 'package.json' ) && options === 'utf-8' ) {
8187 return '{"name": "test"}' ;
8288 }
89+ else if ( fakePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) && options === 'utf-8' ) {
90+ return '{"paths": {"zippedPackage": "solution/test.sppkg"}}' ;
91+ }
8392
8493 throw `Invalid path: ${ fakePath } ` ;
8594 } ) ;
@@ -135,7 +144,13 @@ describe(commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD, () => {
135144 it ( 'creates a default workflow (debug)' , async ( ) => {
136145 sinon . stub ( command as any , 'getProjectRoot' ) . returns ( projectPath ) ;
137146 sinon . stub ( fs , 'existsSync' ) . callsFake ( ( fakePath ) => {
138- if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
147+ if ( fakePath . toString ( ) === path . join ( projectPath , 'package.json' ) ) {
148+ return true ;
149+ }
150+ else if ( fakePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) ) {
151+ return true ;
152+ }
153+ else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
139154 return true ;
140155 }
141156 else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' , 'pipelines' ) ) {
@@ -149,6 +164,9 @@ describe(commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD, () => {
149164 if ( filePath . toString ( ) === path . join ( projectPath , 'package.json' ) && options === 'utf-8' ) {
150165 return '{"name": "test"}' ;
151166 }
167+ else if ( filePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) && options === 'utf-8' ) {
168+ return '{"paths": {"zippedPackage": "solution/test.sppkg"}}' ;
169+ }
152170
153171 throw `Invalid path: ${ filePath } ` ;
154172 } ) ;
@@ -168,12 +186,21 @@ describe(commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD, () => {
168186 if ( filePath . toString ( ) === path . join ( projectPath , 'package.json' ) && options === 'utf-8' ) {
169187 return '{"name": "test"}' ;
170188 }
189+ else if ( filePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) && options === 'utf-8' ) {
190+ return '{"paths": {"zippedPackage": "solution/test.sppkg"}}' ;
191+ }
171192
172193 throw `Invalid path: ${ filePath } ` ;
173194 } ) ;
174195
175196 sinon . stub ( fs , 'existsSync' ) . callsFake ( ( fakePath ) => {
176- if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
197+ if ( fakePath . toString ( ) === path . join ( projectPath , 'package.json' ) ) {
198+ return true ;
199+ }
200+ else if ( fakePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) ) {
201+ return true ;
202+ }
203+ else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
177204 return true ;
178205 }
179206 else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' , 'pipelines' ) ) {
@@ -198,12 +225,21 @@ describe(commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD, () => {
198225 if ( filePath . toString ( ) === path . join ( projectPath , 'package.json' ) && options === 'utf-8' ) {
199226 return '{"name": "test"}' ;
200227 }
228+ else if ( filePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) && options === 'utf-8' ) {
229+ return '{"paths": {"zippedPackage": "solution/test.sppkg"}}' ;
230+ }
201231
202232 throw `Invalid path: ${ filePath } ` ;
203233 } ) ;
204234
205235 sinon . stub ( fs , 'existsSync' ) . callsFake ( ( fakePath ) => {
206- if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
236+ if ( fakePath . toString ( ) === path . join ( projectPath , 'package.json' ) ) {
237+ return true ;
238+ }
239+ else if ( fakePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) ) {
240+ return true ;
241+ }
242+ else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
207243 return true ;
208244 }
209245 else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' , 'pipelines' ) ) {
@@ -228,12 +264,21 @@ describe(commands.PROJECT_AZUREDEVOPS_PIPELINE_ADD, () => {
228264 if ( filePath . toString ( ) === path . join ( projectPath , 'package.json' ) && options === 'utf-8' ) {
229265 return '{"name": "test"}' ;
230266 }
267+ else if ( filePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) && options === 'utf-8' ) {
268+ return '{"paths": {"zippedPackage": "solution/test.sppkg"}}' ;
269+ }
231270
232271 throw `Invalid path: ${ filePath } ` ;
233272 } ) ;
234273
235274 sinon . stub ( fs , 'existsSync' ) . callsFake ( ( fakePath ) => {
236- if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
275+ if ( fakePath . toString ( ) === path . join ( projectPath , 'package.json' ) ) {
276+ return true ;
277+ }
278+ else if ( fakePath . toString ( ) === path . join ( projectPath , 'config' , 'package-solution.json' ) ) {
279+ return true ;
280+ }
281+ else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' ) ) {
237282 return true ;
238283 }
239284 else if ( fakePath . toString ( ) === path . join ( projectPath , '.azuredevops' , 'pipelines' ) ) {
0 commit comments