OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
8 | 8 |
9 import '../../test.dart'; | 9 import '../../test.dart'; |
10 import '../backend/group.dart'; | 10 import '../backend/group.dart'; |
11 import '../backend/invoker.dart'; | 11 import '../backend/invoker.dart'; |
12 import '../backend/metadata.dart'; | 12 import '../backend/metadata.dart'; |
13 import '../backend/suite.dart'; | 13 import '../backend/suite.dart'; |
14 import '../backend/test.dart'; | 14 import '../backend/test.dart'; |
15 import '../backend/test_platform.dart'; | 15 import '../backend/test_platform.dart'; |
16 import '../utils.dart'; | 16 import '../utils.dart'; |
17 import 'load_exception.dart'; | 17 import 'load_exception.dart'; |
| 18 import 'plugin/environment.dart'; |
18 import 'runner_suite.dart'; | 19 import 'runner_suite.dart'; |
19 import 'vm/environment.dart'; | |
20 | 20 |
21 /// A [Suite] emitted by a [Loader] that provides a test-like interface for | 21 /// A [Suite] emitted by a [Loader] that provides a test-like interface for |
22 /// loading a test file. | 22 /// loading a test file. |
23 /// | 23 /// |
24 /// This is used to expose the current status of test loading to the user. It's | 24 /// This is used to expose the current status of test loading to the user. It's |
25 /// important to provide users visibility into what's taking a long time and | 25 /// important to provide users visibility into what's taking a long time and |
26 /// where failures occur. And since some tests may be loaded at the same time as | 26 /// where failures occur. And since some tests may be loaded at the same time as |
27 /// others are run, it's useful to provide that visibility in the form of a test | 27 /// others are run, it's useful to provide that visibility in the form of a test |
28 /// suite so that it can integrate well into the existing reporting interface | 28 /// suite so that it can integrate well into the existing reporting interface |
29 /// without too much extra logic. | 29 /// without too much extra logic. |
30 /// | 30 /// |
31 /// A suite is constructed with logic necessary to produce a test suite. As with | 31 /// A suite is constructed with logic necessary to produce a test suite. As with |
32 /// a normal test body, this logic isn't run until [LiveTest.run] is called. The | 32 /// a normal test body, this logic isn't run until [LiveTest.run] is called. The |
33 /// suite itself is returned by [suite] once it's avaialble, but any errors or | 33 /// suite itself is returned by [suite] once it's avaialble, but any errors or |
34 /// prints will be emitted through the running [LiveTest]. | 34 /// prints will be emitted through the running [LiveTest]. |
35 class LoadSuite extends Suite implements RunnerSuite { | 35 class LoadSuite extends Suite implements RunnerSuite { |
36 final environment = const VMEnvironment(); | 36 final environment = const PluginEnvironment(); |
37 final isDebugging = false; | 37 final isDebugging = false; |
38 final onDebugging = new StreamController<bool>().stream; | 38 final onDebugging = new StreamController<bool>().stream; |
39 | 39 |
40 /// A future that completes to the loaded suite once the suite's test has been | 40 /// A future that completes to the loaded suite once the suite's test has been |
41 /// run and completed successfully. | 41 /// run and completed successfully. |
42 /// | 42 /// |
43 /// This will return `null` if the suite is unavailable for some reason (for | 43 /// This will return `null` if the suite is unavailable for some reason (for |
44 /// example if an error occurred while loading it). | 44 /// example if an error occurred while loading it). |
45 Future<RunnerSuite> get suite async => (await _suiteAndZone)?.first; | 45 Future<RunnerSuite> get suite async => (await _suiteAndZone)?.first; |
46 | 46 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 if (liveTest.errors.isEmpty) return await suite; | 157 if (liveTest.errors.isEmpty) return await suite; |
158 | 158 |
159 var error = liveTest.errors.first; | 159 var error = liveTest.errors.first; |
160 await new Future.error(error.error, error.stackTrace); | 160 await new Future.error(error.error, error.stackTrace); |
161 throw 'unreachable'; | 161 throw 'unreachable'; |
162 } | 162 } |
163 | 163 |
164 Future close() async {} | 164 Future close() async {} |
165 } | 165 } |
OLD | NEW |