@@ -61,10 +61,13 @@ describe("wrangler setup", () => {
6161 test ( "should run autoconfig when project is not configured" , async ( ) => {
6262 await seed ( {
6363 "public/index.html" : `<h1>Hello World</h1>` ,
64+ "package.json" : JSON . stringify ( { } ) ,
6465 } ) ;
6566
6667 // Let's not actually install Wrangler, to speed up tests
67- vi . spyOn ( c3 , "installWrangler" ) . mockImplementation ( async ( ) => { } ) ;
68+ const installSpy = vi
69+ . spyOn ( c3 , "installWrangler" )
70+ . mockImplementation ( async ( ) => { } ) ;
6871
6972 const runSpy = vi . spyOn ( run , "runAutoConfig" ) ;
7073
@@ -73,11 +76,51 @@ describe("wrangler setup", () => {
7376 // autoconfig should have been run
7477 expect ( runSpy ) . toHaveBeenCalled ( ) ;
7578
79+ expect ( installSpy ) . toHaveBeenCalled ( ) ;
80+
7681 expect ( std . out ) . toContain (
7782 "🎉 Your project is now setup to deploy to Cloudflare"
7883 ) ;
7984 } ) ;
8085
86+ test ( "should not display completion message when disabled" , async ( ) => {
87+ await seed ( {
88+ "public/index.html" : `<h1>Hello World</h1>` ,
89+ } ) ;
90+
91+ // Let's not actually install Wrangler, to speed up tests
92+ vi . spyOn ( c3 , "installWrangler" ) . mockImplementation ( async ( ) => { } ) ;
93+
94+ const runSpy = vi . spyOn ( run , "runAutoConfig" ) ;
95+
96+ await runWrangler ( "setup --no-completion-message" ) ;
97+
98+ // autoconfig should have been run
99+ expect ( runSpy ) . toHaveBeenCalled ( ) ;
100+
101+ expect ( std . out ) . not . toContain ( "🎉 Your project" ) ;
102+ } ) ;
103+
104+ test ( "should not install Wrangler when skipped" , async ( ) => {
105+ await seed ( {
106+ "public/index.html" : `<h1>Hello World</h1>` ,
107+ "package.json" : JSON . stringify ( { } ) ,
108+ } ) ;
109+
110+ const installSpy = vi
111+ . spyOn ( c3 , "installWrangler" )
112+ . mockImplementation ( async ( ) => { } ) ;
113+
114+ const runSpy = vi . spyOn ( run , "runAutoConfig" ) ;
115+
116+ await runWrangler ( "setup --no-install-wrangler" ) ;
117+
118+ // autoconfig should have been run
119+ expect ( runSpy ) . toHaveBeenCalled ( ) ;
120+
121+ expect ( installSpy ) . not . toHaveBeenCalled ( ) ;
122+ } ) ;
123+
81124 describe ( "--dry-run" , ( ) => {
82125 test ( "should stop before running autoconfig when project is already configured" , async ( ) => {
83126 await seed ( {
0 commit comments