@@ -192,6 +192,64 @@ describe("release-alpha-train script", () => {
192192 } ) ;
193193 } ) ;
194194
195+ it ( "blocks GoReleaser when Changesets did not publish npm packages" , async ( ) => {
196+ const cwd = await fixtureRepo ( ) ;
197+
198+ await expect (
199+ releaseAlphaTrain . inspectAlphaReleaseTrain ( {
200+ cwd,
201+ execFile : commandMock ( ) ,
202+ published : false ,
203+ remote : false ,
204+ } ) ,
205+ ) . resolves . toMatchObject ( {
206+ shouldComplete : false ,
207+ skipReason : "npm publish did not run" ,
208+ } ) ;
209+ } ) ;
210+
211+ it ( "rejects prepare when Changesets did not publish npm packages" , async ( ) => {
212+ const cwd = await fixtureRepo ( ) ;
213+
214+ await expect (
215+ releaseAlphaTrain . prepareAlphaReleaseTrain ( {
216+ cwd,
217+ execFile : commandMock ( ) ,
218+ published : false ,
219+ } ) ,
220+ ) . rejects . toThrow ( "alpha release train is not ready to complete: npm publish did not run" ) ;
221+ } ) ;
222+
223+ it ( "allows GoReleaser recovery when npm did not publish but the release tag exists" , async ( ) => {
224+ const cwd = await fixtureRepo ( ) ;
225+
226+ const result = await releaseAlphaTrain . prepareAlphaReleaseTrain ( {
227+ cwd,
228+ execFile : commandMock ( { tagCommit : "head-commit" } ) ,
229+ published : false ,
230+ } ) ;
231+
232+ expect ( result . shouldCreateTag ) . toBe ( false ) ;
233+ expect ( result . shouldRunGoreleaser ) . toBe ( true ) ;
234+ expect ( result . shouldUpdateRelease ) . toBe ( true ) ;
235+ } ) ;
236+
237+ it ( "allows completion after Changesets publishes npm packages" , async ( ) => {
238+ const cwd = await fixtureRepo ( ) ;
239+
240+ await expect (
241+ releaseAlphaTrain . inspectAlphaReleaseTrain ( {
242+ cwd,
243+ execFile : commandMock ( ) ,
244+ published : true ,
245+ remote : false ,
246+ } ) ,
247+ ) . resolves . toMatchObject ( {
248+ shouldComplete : true ,
249+ skipReason : "" ,
250+ } ) ;
251+ } ) ;
252+
195253 it ( "prunes empty changesets before Changesets decides whether to publish" , async ( ) => {
196254 const cwd = await fixtureRepo ( {
197255 changesets : {
0 commit comments