@@ -50,10 +50,6 @@ const mockUserResponses = (mockResponses: {
5050 return returnValues [ callCount ++ ] ;
5151 } ) ;
5252
53- const confirmAnswers : Record < string , boolean > = {
54- "Is this your desired changeset?" : true ,
55- } ;
56-
5753 if (
5854 mockResponses . consoleSummaries != null &&
5955 mockResponses . editorSummaries != null
@@ -75,13 +71,6 @@ const mockUserResponses = (mockResponses: {
7571 } else {
7672 mockedUtils . askQuestion . mockResolvedValue ( summary ) ;
7773 }
78- mockedUtils . askConfirm . mockImplementation ( async ( question ) => {
79- question = stripVTControlCharacters ( question ) ;
80- if ( confirmAnswers [ question ] ) {
81- return confirmAnswers [ question ] ;
82- }
83- throw new Error ( `An answer could not be found for ${ question } ` ) ;
84- } ) ;
8574} ;
8675
8776beforeEach ( ( ) => {
@@ -183,18 +172,8 @@ describe("Add command", () => {
183172 const summary = "summary message mock" ;
184173 mockedUtils . askList . mockResolvedValueOnce ( "minor" ) ;
185174
186- const confirmAnswers : Record < string , boolean > = {
187- "Is this your desired changeset?" : true ,
188- } ;
189175 mockedUtils . askQuestion . mockResolvedValue ( "" ) ;
190176 mockedAskWithEditor . mockResolvedValueOnce ( summary ) ;
191- mockedUtils . askConfirm . mockImplementation ( async ( question ) => {
192- question = stripVTControlCharacters ( question ) ;
193- if ( confirmAnswers [ question ] ) {
194- return confirmAnswers [ question ] ;
195- }
196- throw new Error ( `An answer could not be found for ${ question } ` ) ;
197- } ) ;
198177
199178 await addChangeset ( { cwd } ) ;
200179
@@ -292,7 +271,6 @@ describe("Add command", () => {
292271 } ) ;
293272
294273 mockedUtils . askList . mockReturnValueOnce ( Promise . resolve ( "minor" ) ) ;
295- mockedUtils . askConfirm . mockReturnValueOnce ( Promise . resolve ( true ) ) ;
296274
297275 await addChangeset ( { cwd, message : "summary from message" } ) ;
298276
@@ -304,9 +282,6 @@ describe("Add command", () => {
304282 releases : [ { name : "single-package" , type : "minor" } ] ,
305283 } ) ,
306284 ) ;
307- expect ( mockedUtils . askConfirm ) . toHaveBeenCalledWith (
308- "Is this your desired changeset?" ,
309- ) ;
310285 expect ( mockedUtils . askQuestion ) . not . toHaveBeenCalled ( ) ;
311286 expect ( mockedAskWithEditor ) . not . toHaveBeenCalled ( ) ;
312287 } ) ;
@@ -322,7 +297,6 @@ describe("Add command", () => {
322297 } ) ;
323298
324299 mockedUtils . askList . mockReturnValueOnce ( Promise . resolve ( "patch" ) ) ;
325- mockedUtils . askConfirm . mockReturnValueOnce ( Promise . resolve ( true ) ) ;
326300
327301 await addChangeset ( { cwd, message : "" } ) ;
328302
@@ -368,84 +342,10 @@ describe("Add command", () => {
368342 releases : [ { name : "pkg-a" , type : "patch" } ] ,
369343 } ) ,
370344 ) ;
371- expect ( mockedUtils . askConfirm ) . toHaveBeenCalledWith (
372- "Is this your desired changeset?" ,
373- ) ;
374- expect ( mockedUtils . askQuestion ) . not . toHaveBeenCalled ( ) ;
375- expect ( mockedAskWithEditor ) . not . toHaveBeenCalled ( ) ;
376- } ) ;
377-
378- it ( "should skip confirmation when release type flags and message are passed" , async ( ) => {
379- const cwd = await testdir ( {
380- "package.json" : JSON . stringify ( {
381- private : true ,
382- workspaces : [ "packages/*" ] ,
383- } ) ,
384- "package-lock.json" : "" ,
385- "packages/pkg-a/package.json" : JSON . stringify ( {
386- name : "pkg-a" ,
387- version : "1.0.0" ,
388- } ) ,
389- ".changeset/config.json" : JSON . stringify ( defaultConfig ) ,
390- } ) ;
391-
392- await addChangeset ( {
393- cwd,
394- message : "summary from message" ,
395- patch : [ "pkg-a" ] ,
396- } ) ;
397-
398- const changesets = await getChangesets ( cwd ) ;
399- expect ( changesets . length ) . toBe ( 1 ) ;
400- expect ( changesets [ 0 ] ) . toEqual (
401- expect . objectContaining ( {
402- summary : "summary from message" ,
403- releases : [ { name : "pkg-a" , type : "patch" } ] ,
404- } ) ,
405- ) ;
406- expect ( mockedUtils . askConfirm ) . not . toHaveBeenCalled ( ) ;
407345 expect ( mockedUtils . askQuestion ) . not . toHaveBeenCalled ( ) ;
408- expect ( mockedUtils . askMultiselect ) . not . toHaveBeenCalled ( ) ;
409346 expect ( mockedAskWithEditor ) . not . toHaveBeenCalled ( ) ;
410347 } ) ;
411348
412- it ( "should keep confirmation flow when only release type flags are passed" , async ( ) => {
413- const cwd = await testdir ( {
414- "package.json" : JSON . stringify ( {
415- private : true ,
416- workspaces : [ "packages/*" ] ,
417- } ) ,
418- "package-lock.json" : "" ,
419- "packages/pkg-a/package.json" : JSON . stringify ( {
420- name : "pkg-a" ,
421- version : "1.0.0" ,
422- } ) ,
423- ".changeset/config.json" : JSON . stringify ( defaultConfig ) ,
424- } ) ;
425-
426- mockedUtils . askQuestion . mockResolvedValue ( "summary from prompt" ) ;
427- mockedUtils . askConfirm . mockResolvedValue ( true ) ;
428-
429- await addChangeset ( {
430- cwd,
431- patch : [ "pkg-a" ] ,
432- } ) ;
433-
434- const changesets = await getChangesets ( cwd ) ;
435- expect ( changesets . length ) . toBe ( 1 ) ;
436- expect ( changesets [ 0 ] ) . toEqual (
437- expect . objectContaining ( {
438- summary : "summary from prompt" ,
439- releases : [ { name : "pkg-a" , type : "patch" } ] ,
440- } ) ,
441- ) ;
442- expect ( mockedUtils . askConfirm ) . toHaveBeenCalledWith (
443- "Is this your desired changeset?" ,
444- ) ;
445- expect ( mockedUtils . askQuestion ) . toHaveBeenCalledOnce ( ) ;
446- expect ( mockedUtils . askMultiselect ) . not . toHaveBeenCalled ( ) ;
447- } ) ;
448-
449349 it ( "should allow using message with empty changesets" , async ( ) => {
450350 const cwd = await testdir ( {
451351 "package.json" : JSON . stringify ( {
0 commit comments