@@ -59,7 +59,7 @@ void main() {
5959 xcodeProjectInterpreter.isInstalled = true ;
6060 xcodeProjectInterpreter.version = Version (1000 , 0 , 0 );
6161 final CommandRunner <void > runner = createTestCommandRunner (CleanCommand ());
62- await runner.run (< String > ['clean' ]);
62+ await runner.run (< String > ['clean' , '--include-xcode-workspace' ]);
6363
6464 expect (buildDirectory, isNot (exists));
6565 expect (projectUnderTest.dartTool, isNot (exists));
@@ -102,6 +102,31 @@ void main() {
102102 },
103103 );
104104
105+ testUsingContext (
106+ '$CleanCommand does not clean Xcode by default' ,
107+ () async {
108+ final FlutterProject projectUnderTest = setupProjectUnderTest (fs.currentDirectory, true );
109+ xcodeProjectInterpreter.isInstalled = true ;
110+ xcodeProjectInterpreter.version = Version (1000 , 0 , 0 );
111+ final CommandRunner <void > runner = createTestCommandRunner (CleanCommand ());
112+ await runner.run (< String > ['clean' ]);
113+
114+ expect (buildDirectory, isNot (exists));
115+ expect (projectUnderTest.dartTool, isNot (exists));
116+ expect (projectUnderTest.android.ephemeralDirectory, isNot (exists));
117+ expect (projectUnderTest.ios.ephemeralDirectory, isNot (exists));
118+
119+ // The workspaces should be empty since we didn't pass --include-xcode-workspace.
120+ expect (xcodeProjectInterpreter.workspaces, isEmpty);
121+ },
122+ overrides: < Type , Generator > {
123+ FileSystem : () => fs,
124+ ProcessManager : () => FakeProcessManager .any (),
125+ Xcode : () => xcode,
126+ XcodeProjectInterpreter : () => xcodeProjectInterpreter,
127+ },
128+ );
129+
105130 testUsingContext (
106131 '$CleanCommand does not clean the example directory by default' ,
107132 () async {
@@ -116,7 +141,7 @@ void main() {
116141 xcodeProjectInterpreter.isInstalled = true ;
117142 xcodeProjectInterpreter.version = Version (1000 , 0 , 0 );
118143 final CommandRunner <void > runner = createTestCommandRunner (CleanCommand ());
119- await runner.run (< String > ['clean' ]);
144+ await runner.run (< String > ['clean' , '--include-xcode-workspace' ]);
120145
121146 expect (buildDirectory, isNot (exists));
122147
@@ -159,7 +184,7 @@ void main() {
159184 xcodeProjectInterpreter.version = Version (1000 , 0 , 0 );
160185
161186 final CommandRunner <void > runner = createTestCommandRunner (CleanCommand ());
162- await runner.run (< String > ['clean' , '--include-example' ]);
187+ await runner.run (< String > ['clean' , '--include-example' , '--include-xcode-workspace' ]);
163188
164189 expect (buildDirectory, isNot (exists));
165190 expect (projectUnderTest.dartTool, isNot (exists));
@@ -209,7 +234,7 @@ void main() {
209234 xcodeProjectInterpreter.isInstalled = true ;
210235 xcodeProjectInterpreter.version = Version (1000 , 0 , 0 );
211236 final CommandRunner <void > runner = createTestCommandRunner (CleanCommand ());
212- await runner.run (< String > ['clean' , '--include-example' ]);
237+ await runner.run (< String > ['clean' , '--include-example' , '--include-xcode-workspace' ]);
213238
214239 expect (testLogger.statusText, contains ('No example app found' ));
215240 },
@@ -302,7 +327,7 @@ void main() {
302327
303328 final command = CleanCommand (verbose: true );
304329 final CommandRunner <void > runner = createTestCommandRunner (command);
305- await runner.run (< String > ['clean' ]);
330+ await runner.run (< String > ['clean' , '--include-xcode-workspace' ]);
306331
307332 expect (xcodeProjectInterpreter.workspaces, const < CleanWorkspaceCall > [
308333 CleanWorkspaceCall ('/ios/Runner.xcworkspace' , 'Runner' , true ),
0 commit comments