@@ -87,6 +87,12 @@ describe('sentry-cli', function () {
8787
8888 assert . equal ( typeof plugin . didFail , 'function' , 'Implements didFail' ) ;
8989 } ) ;
90+
91+ it ( 'didBuild' , function ( ) {
92+ const plugin = Plugin . createDeployPlugin ( { name : 'sentry-cli' } ) ;
93+
94+ assert . equal ( typeof plugin . didBuild , 'function' , 'Implements didBuild' ) ;
95+ } ) ;
9096 } ) ;
9197
9298 describe ( 'configure' , function ( ) {
@@ -176,6 +182,47 @@ describe('sentry-cli', function () {
176182
177183 assert . equal ( plugin . readConfig ( 'url' ) , '' ) ;
178184 } ) ;
185+
186+ it ( 'injectDebugIds' , function ( ) {
187+ const plugin = Plugin . createDeployPlugin ( { name : 'sentry-cli' } ) ;
188+
189+ plugin . beforeHook ( this . context ) ;
190+ plugin . configure ( this . context ) ;
191+
192+ assert . equal ( plugin . readConfig ( 'injectDebugIds' ) , true ) ;
193+ } ) ;
194+ } ) ;
195+ } ) ;
196+
197+ describe ( 'didBuild' , function ( ) {
198+ it ( 'injects debug IDs' , function ( ) {
199+ const plugin = Plugin . createDeployPlugin ( { name : 'sentry-cli' } ) ;
200+ const stub = this . sinon . stub ( plugin , '_exec' ) ;
201+
202+ plugin . beforeHook ( this . context ) ;
203+ plugin . configure ( this . context ) ;
204+ plugin . didBuild ( ) ;
205+
206+ this . sinon . assert . calledWithExactly (
207+ stub ,
208+ `${ SENTRY_BIN_PATH } --auth-token my-auth-token sourcemaps --org my-org --project my-project inject "${ path . join (
209+ 'my-dest-dir' ,
210+ 'assets'
211+ ) } "`
212+ ) ;
213+ } ) ;
214+
215+ it ( 'skips debug ID injection when disabled' , function ( ) {
216+ const plugin = Plugin . createDeployPlugin ( { name : 'sentry-cli' } ) ;
217+ const stub = this . sinon . stub ( plugin , '_exec' ) ;
218+
219+ this . context . config [ 'sentry-cli' ] . injectDebugIds = false ;
220+
221+ plugin . beforeHook ( this . context ) ;
222+ plugin . configure ( this . context ) ;
223+ plugin . didBuild ( ) ;
224+
225+ this . sinon . assert . notCalled ( stub ) ;
179226 } ) ;
180227 } ) ;
181228
0 commit comments