analyzer_testing: Deprecate the flutter_test mock; only used in two DAS tests.

Work towards https://github.com/dart-lang/sdk/issues/61597

Change-Id: I32caa38bff42ad9117829cca9be8b892da228a9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/472960
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Sam Rawlins
2026-01-14 11:03:09 -08:00
committed by Commit Queue
parent 37dfbea236
commit 9062f80146
4 changed files with 25 additions and 3 deletions
@@ -78,8 +78,24 @@ mixin ConfigurationFilesMixin on MockPackagesMixin {
}
if (addFlutterTestPackageDep) {
var libFolder = addFlutterTest();
config.add(name: 'flutter_test', rootPath: libFolder.parent.path);
var flutterTestRootPath = '/packages/flutter_test';
var flutterTestRoot = resourceProvider.getFolder(flutterTestRootPath);
var libFolder = flutterTestRoot.getChildAssumingFolder('lib')..create();
libFolder.getChildAssumingFile('flutter_test.dart').writeAsStringSync(r'''
void test(Object description, dynamic Function() body) {}
void group(Object description, void Function() body) {}
void main() {
// Because this file is called 'flutter_test.dart' and is inside the 'test'
// folder, it will be considered a test suite. To avoid it failing the bots
// with "Invoked Dart programs must have a 'main' function defined", provide
// an empty main function.
}
''');
config.add(name: 'flutter_test', rootPath: flutterTestRootPath);
}
if (addVectorMathPackageDep) {
+2
View File
@@ -1,5 +1,7 @@
## 0.1.9-dev
- Deprecate `MockPackagesMixin.addUI`; This is replaced by `addSkyEngine`.
- Deprecate `MockPackagesMixin.addFlutterTest`. A mock `flutter_test` package
can still be written with `PubPackageResolutionTest.newPackage`.
## 0.1.8
+1 -1
View File
@@ -29,7 +29,7 @@ package:analyzer_testing/mock_packages/mock_packages.dart:
addFfi (method: Folder Function())
addFixnum (method: Folder Function())
addFlutter (method: Folder Function())
addFlutterTest (method: Folder Function())
addFlutterTest (method: Folder Function(), deprecated)
addJs (method: Folder Function(), deprecated)
addKernel (method: Folder Function(), deprecated)
addMeta (method: Folder Function())
@@ -141,6 +141,10 @@ mixin MockPackagesMixin {
return packageFolder.getChildAssumingFolder('lib');
}
@Deprecated(
'The mock flutter_test package is deprecated; use '
'`PubPackageResolutionTest.newPackage` to make a custom mock',
)
Folder addFlutterTest() {
var packageFolder = _addFiles('flutter_test');
return packageFolder.getChildAssumingFolder('lib');