@@ -262,6 +262,89 @@ index abc123..def456 100644
262
262
);
263
263
});
264
264
265
+ test ('fails with specific text for combo PRs using the recommended tooling' ,
266
+ () async {
267
+ final Directory pluginGroupDir = packagesDir.childDirectory ('foo' );
268
+ final RepositoryPackage appFacing = createFakePlugin ('foo' , pluginGroupDir);
269
+ final RepositoryPackage implementation =
270
+ createFakePlugin ('foo_bar' , pluginGroupDir);
271
+ final RepositoryPackage platformInterface =
272
+ createFakePlugin ('foo_platform_interface' , pluginGroupDir);
273
+
274
+ void addFakeTempPubspecOverrides (RepositoryPackage package) {
275
+ final String contents = package.pubspecFile.readAsStringSync ();
276
+ package.pubspecFile.writeAsStringSync ('''
277
+ $contents
278
+
279
+ # FOR TESTING AND INITIAL REVIEW ONLY. $kDoNotLandWarning .
280
+ dependency_overrides:
281
+ foo_platform_interface:
282
+ path: ../../../foo/foo_platform_interface
283
+ ''' );
284
+ }
285
+
286
+ addFakeTempPubspecOverrides (appFacing.getExamples ().first);
287
+ addFakeTempPubspecOverrides (implementation.getExamples ().first);
288
+
289
+ const String appFacingChanges = '''
290
+ diff --git a/packages/foo/foo/lib/foo.dart b/packages/foo/foo/lib/foo.dart
291
+ index abc123..def456 100644
292
+ --- a/packages/foo/foo/lib/foo.dart
293
+ +++ b/packages/foo/foo/lib/foo.dart
294
+ @@ -51,6 +51,9 @@ Future<bool> launchUrl(
295
+ return true;
296
+ }
297
+
298
+ +// This is a new method
299
+ +bool foo() => true;
300
+ +
301
+ // This in an existing method
302
+ void aMethod() {
303
+ // Do things.
304
+ ''' ;
305
+
306
+ final String changedFileOutput = < File > [
307
+ appFacing.libDirectory.childFile ('foo.dart' ),
308
+ implementation.libDirectory.childFile ('foo.dart' ),
309
+ platformInterface.pubspecFile,
310
+ platformInterface.libDirectory.childFile ('foo.dart' ),
311
+ ].map ((File file) => file.path).join ('\n ' );
312
+ processRunner.mockProcessesForExecutable['git-diff' ] = < FakeProcessInfo > [
313
+ FakeProcessInfo (MockProcess (stdout: changedFileOutput)),
314
+ FakeProcessInfo (MockProcess (stdout: appFacingChanges),
315
+ < String > ['' , 'HEAD' , '--' , '/packages/foo/foo/lib/foo.dart' ]),
316
+ // The others diffs don't need to be specified, since empty diff is also
317
+ // treated as a non-comment change.
318
+ ];
319
+
320
+ Error ? commandError;
321
+ final List <String > output = await runCapturingPrint (
322
+ runner, < String > ['federation-safety-check' ], errorHandler: (Error e) {
323
+ commandError = e;
324
+ });
325
+
326
+ expect (commandError, isA <ToolExit >());
327
+ expect (
328
+ output,
329
+ containsAllInOrder (< Matcher > [
330
+ contains ('Running for foo/foo...' ),
331
+ contains ('"DO NOT MERGE" found in pubspec.yaml, so this is assumed to '
332
+ 'be the initial combination PR for a federated change, following '
333
+ 'the standard repository procedure. This failure is expected, in '
334
+ 'order to prevent accidentally landing the temporary overrides, '
335
+ 'and will automatically be resolved when the temporary overrides '
336
+ 'are replaced by dependency version bumps later in the process.' ),
337
+ contains ('Running for foo_bar...' ),
338
+ contains ('"DO NOT MERGE" found in pubspec.yaml' ),
339
+ contains ('The following packages had errors:' ),
340
+ contains ('foo/foo:\n '
341
+ ' Unresolved combo PR.' ),
342
+ contains ('foo_bar:\n '
343
+ ' Unresolved combo PR.' ),
344
+ ]),
345
+ );
346
+ });
347
+
265
348
test ('ignores test-only changes to interface packages' , () async {
266
349
final Directory pluginGroupDir = packagesDir.childDirectory ('foo' );
267
350
final RepositoryPackage appFacing = createFakePlugin ('foo' , pluginGroupDir);
0 commit comments