OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 | 8 |
9 import 'src/backend/declarer.dart'; | 9 import 'src/backend/declarer.dart'; |
10 import 'src/backend/test_platform.dart'; | 10 import 'src/backend/test_platform.dart'; |
11 import 'src/frontend/timeout.dart'; | 11 import 'src/frontend/timeout.dart'; |
12 import 'src/runner/engine.dart'; | 12 import 'src/runner/engine.dart'; |
| 13 import 'src/runner/plugin/environment.dart'; |
13 import 'src/runner/reporter/expanded.dart'; | 14 import 'src/runner/reporter/expanded.dart'; |
14 import 'src/runner/runner_suite.dart'; | 15 import 'src/runner/runner_suite.dart'; |
15 import 'src/runner/vm/environment.dart'; | |
16 import 'src/utils.dart'; | 16 import 'src/utils.dart'; |
17 | 17 |
18 export 'package:matcher/matcher.dart'; | 18 export 'package:matcher/matcher.dart'; |
19 | 19 |
20 export 'src/frontend/expect.dart'; | 20 export 'src/frontend/expect.dart'; |
21 export 'src/frontend/expect_async.dart'; | 21 export 'src/frontend/expect_async.dart'; |
22 export 'src/frontend/future_matchers.dart'; | 22 export 'src/frontend/future_matchers.dart'; |
23 export 'src/frontend/on_platform.dart'; | 23 export 'src/frontend/on_platform.dart'; |
24 export 'src/frontend/prints_matcher.dart'; | 24 export 'src/frontend/prints_matcher.dart'; |
25 export 'src/frontend/skip.dart'; | 25 export 'src/frontend/skip.dart'; |
(...skipping 18 matching lines...) Expand all Loading... |
44 if (declarer != null) return declarer; | 44 if (declarer != null) return declarer; |
45 if (_globalDeclarer != null) return _globalDeclarer; | 45 if (_globalDeclarer != null) return _globalDeclarer; |
46 | 46 |
47 // Since there's no Zone-scoped declarer, the test file is being run directly. | 47 // Since there's no Zone-scoped declarer, the test file is being run directly. |
48 // In order to run the tests, we set up our own Declarer via | 48 // In order to run the tests, we set up our own Declarer via |
49 // [_globalDeclarer], and schedule a microtask to run the tests once they're | 49 // [_globalDeclarer], and schedule a microtask to run the tests once they're |
50 // finished being defined. | 50 // finished being defined. |
51 _globalDeclarer = new Declarer(); | 51 _globalDeclarer = new Declarer(); |
52 scheduleMicrotask(() async { | 52 scheduleMicrotask(() async { |
53 var suite = new RunnerSuite( | 53 var suite = new RunnerSuite( |
54 // TODO(nweiz): Use a different environment if VM environment starts | 54 const PluginEnvironment(), |
55 // import dart:io before cross-platform libraries exist. | |
56 const VMEnvironment(), | |
57 _globalDeclarer.build(), | 55 _globalDeclarer.build(), |
58 path: p.prettyUri(Uri.base), | 56 path: p.prettyUri(Uri.base), |
59 platform: TestPlatform.vm, | 57 platform: TestPlatform.vm, |
60 os: currentOSGuess); | 58 os: currentOSGuess); |
61 | 59 |
62 var engine = new Engine(); | 60 var engine = new Engine(); |
63 engine.suiteSink.add(suite); | 61 engine.suiteSink.add(suite); |
64 engine.suiteSink.close(); | 62 engine.suiteSink.close(); |
65 ExpandedReporter.watch(engine, | 63 ExpandedReporter.watch(engine, |
66 color: true, printPath: false, printPlatform: false); | 64 color: true, printPath: false, printPlatform: false); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 /// prefer [tearDown], and only use [tearDOwnAll] if the callback is | 234 /// prefer [tearDown], and only use [tearDOwnAll] if the callback is |
237 /// prohibitively slow. | 235 /// prohibitively slow. |
238 void tearDownAll(callback()) => _declarer.tearDownAll(callback); | 236 void tearDownAll(callback()) => _declarer.tearDownAll(callback); |
239 | 237 |
240 /// Registers an exception that was caught for the current test. | 238 /// Registers an exception that was caught for the current test. |
241 void registerException(error, [StackTrace stackTrace]) { | 239 void registerException(error, [StackTrace stackTrace]) { |
242 // This will usually forward directly to [Invoker.current.handleError], but | 240 // This will usually forward directly to [Invoker.current.handleError], but |
243 // going through the zone API allows other zones to consistently see errors. | 241 // going through the zone API allows other zones to consistently see errors. |
244 Zone.current.handleUncaughtError(error, stackTrace); | 242 Zone.current.handleUncaughtError(error, stackTrace); |
245 } | 243 } |
OLD | NEW |