From 26ba571a2699e69fd5f23272e91ac7fea45733a8 Mon Sep 17 00:00:00 2001 From: Nate Bosch <nbosch1@gmail.com> Date: Wed, 5 Feb 2020 09:16:24 -0800 Subject: [PATCH] Remove arguments to runInIsolate utility (#1169) The `resolver` argument was only used from external packages which can be migrated off this utility. The `checked` argument was only used to allow `spawnHybrid` APIs to run code without asserts, but we want all test code to run with asserts, including server side utilities. --- pkgs/test_core/CHANGELOG.md | 4 ++++ .../test_core/lib/src/runner/vm/platform.dart | 2 +- pkgs/test_core/lib/src/util/dart.dart | 24 +++++++------------ pkgs/test_core/pubspec.yaml | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pkgs/test_core/CHANGELOG.md b/pkgs/test_core/CHANGELOG.md index 5064f1a5..0d6474e6 100644 --- a/pkgs/test_core/CHANGELOG.md +++ b/pkgs/test_core/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.1-dev + +* Enable asserts in code running through `spawnHybrid` APIs. + ## 0.3.0 * Bump minimum SDK to `2.4.0` for safer usage of for-loop elements. diff --git a/pkgs/test_core/lib/src/runner/vm/platform.dart b/pkgs/test_core/lib/src/runner/vm/platform.dart index 12bf36c0..83e4b4fc 100644 --- a/pkgs/test_core/lib/src/runner/vm/platform.dart +++ b/pkgs/test_core/lib/src/runner/vm/platform.dart @@ -139,7 +139,7 @@ Future<Isolate> _spawnDataIsolate(String path, SendPort message) async { var channel = serializeSuite(() => test.main); IsolateChannel.connectSend(message).pipe(channel); } - ''', message, checked: true); + ''', message); } Future<Isolate> _spawnPrecompiledIsolate( diff --git a/pkgs/test_core/lib/src/util/dart.dart b/pkgs/test_core/lib/src/util/dart.dart index da177330..bdb39eab 100644 --- a/pkgs/test_core/lib/src/util/dart.dart +++ b/pkgs/test_core/lib/src/util/dart.dart @@ -8,7 +8,6 @@ import 'dart:isolate'; // ignore: deprecated_member_use import 'package:analyzer/analyzer.dart'; -import 'package:package_resolver/package_resolver.dart'; import 'package:source_span/source_span.dart'; import 'string_literal_iterator.dart'; @@ -19,20 +18,15 @@ import 'string_literal_iterator.dart'; /// they will be resolved in the same context as the host isolate. [message] is /// passed to the [main] method of the code being run; the caller is responsible /// for using this to establish communication with the isolate. -/// -/// If [resolver] is passed, its package resolution strategy is used to resolve -/// code in the spawned isolate. It defaults to [PackageResolver.current]. -Future<Isolate> runInIsolate(String code, message, - {PackageResolver resolver, bool checked, SendPort onExit}) async { - resolver ??= PackageResolver.current; - return await Isolate.spawnUri( - Uri.dataFromString(code, mimeType: 'application/dart', encoding: utf8), - [], - message, - packageConfig: await resolver.packageConfigUri, - checked: checked, - onExit: onExit); -} +Future<Isolate> runInIsolate(String code, Object message, + {SendPort onExit}) async => + Isolate.spawnUri( + Uri.dataFromString(code, mimeType: 'application/dart', encoding: utf8), + [], + message, + packageConfig: await Isolate.packageConfig, + checked: true, + onExit: onExit); /// Takes a span whose source is the value of a string that has been parsed from /// a Dart file and returns the corresponding span from within that Dart file. diff --git a/pkgs/test_core/pubspec.yaml b/pkgs/test_core/pubspec.yaml index 8a88fc60..312fe7b1 100644 --- a/pkgs/test_core/pubspec.yaml +++ b/pkgs/test_core/pubspec.yaml @@ -1,5 +1,5 @@ name: test_core -version: 0.3.0 +version: 0.3.1-dev description: A basic library for writing tests and running them on the VM. homepage: https://github.com/dart-lang/test/blob/master/pkgs/test_core -- GitLab