Shim package:test to avoid matcher issues (#20602)
* Upgrade everything except matcher. * Roll matcher (and test) * Adjust tests that depend on flutter:test directly to depend on a shim * Require use of package:test shim and remove other references to package:test
This commit is contained in:
committed by
Todd Volkert
parent
8de0e15e4f
commit
686d8f8a22
14
dev/bots/test/common.dart
Normal file
14
dev/bots/test/common.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2018 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
import 'package:test/test.dart' as test_package show TypeMatcher;
|
||||
|
||||
export 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
|
||||
// Defines a 'package:test' shim.
|
||||
// TODO(ianh): Remove this file once https://github.com/dart-lang/matcher/issues/98 is fixed
|
||||
|
||||
/// A matcher that compares the type of the actual value to the type argument T.
|
||||
Matcher isInstanceOf<T>() => new test_package.TypeMatcher<T>(); // ignore: prefer_const_constructors, https://github.com/dart-lang/sdk/issues/32544
|
||||
@@ -8,7 +8,8 @@ import 'dart:io';
|
||||
|
||||
import 'package:process/process.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'common.dart';
|
||||
|
||||
/// A mock that can be used to fake a process manager that runs commands
|
||||
/// and returns results.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'common.dart';
|
||||
|
||||
import 'fake_process_manager.dart';
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ import 'dart:io' hide Platform;
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:platform/platform.dart' show FakePlatform;
|
||||
|
||||
import '../prepare_package.dart';
|
||||
import 'common.dart';
|
||||
import 'fake_process_manager.dart';
|
||||
|
||||
void main() {
|
||||
@@ -25,7 +25,7 @@ void main() {
|
||||
expectAsync1((List<String> commandLine) async {
|
||||
return processRunner.runProcess(commandLine);
|
||||
})(<String>['this_executable_better_not_exist_2857632534321']),
|
||||
throwsA(const isInstanceOf<ProcessRunnerException>()));
|
||||
throwsA(isInstanceOf<ProcessRunnerException>()));
|
||||
try {
|
||||
await processRunner.runProcess(<String>['this_executable_better_not_exist_2857632534321']);
|
||||
} on ProcessRunnerException catch (e) {
|
||||
@@ -62,7 +62,7 @@ void main() {
|
||||
expectAsync1((List<String> commandLine) async {
|
||||
return processRunner.runProcess(commandLine);
|
||||
})(<String>['echo', 'test']),
|
||||
throwsA(const isInstanceOf<ProcessRunnerException>()));
|
||||
throwsA(isInstanceOf<ProcessRunnerException>()));
|
||||
});
|
||||
});
|
||||
group('ArchiveCreator for $platformName', () {
|
||||
@@ -204,7 +204,7 @@ void main() {
|
||||
};
|
||||
processManager.fakeResults = calls;
|
||||
expect(expectAsync0(creator.initializeRepo),
|
||||
throwsA(const isInstanceOf<ProcessRunnerException>()));
|
||||
throwsA(isInstanceOf<ProcessRunnerException>()));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user