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 '../backend/group.dart'; | 9 import '../backend/group.dart'; |
10 import '../frontend/expect.dart'; | 10 import '../frontend/expect.dart'; |
| 11 import '../runner/load_suite.dart'; |
11 import '../utils.dart'; | 12 import '../utils.dart'; |
12 import 'closed_exception.dart'; | 13 import 'closed_exception.dart'; |
13 import 'live_test.dart'; | 14 import 'live_test.dart'; |
14 import 'live_test_controller.dart'; | 15 import 'live_test_controller.dart'; |
15 import 'metadata.dart'; | 16 import 'metadata.dart'; |
16 import 'operating_system.dart'; | 17 import 'operating_system.dart'; |
17 import 'outstanding_callback_counter.dart'; | 18 import 'outstanding_callback_counter.dart'; |
18 import 'state.dart'; | 19 import 'state.dart'; |
19 import 'suite.dart'; | 20 import 'suite.dart'; |
20 import 'test.dart'; | 21 import 'test.dart'; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } else if (liveTest.state.result != Result.error) { | 240 } else if (liveTest.state.result != Result.error) { |
240 _controller.setState(const State(Status.complete, Result.failure)); | 241 _controller.setState(const State(Status.complete, Result.failure)); |
241 } | 242 } |
242 | 243 |
243 _controller.addError(error, stackTrace); | 244 _controller.addError(error, stackTrace); |
244 removeAllOutstandingCallbacks(); | 245 removeAllOutstandingCallbacks(); |
245 | 246 |
246 // If a test was marked as success but then had an error, that indicates | 247 // If a test was marked as success but then had an error, that indicates |
247 // that it was poorly-written and could be flaky. | 248 // that it was poorly-written and could be flaky. |
248 if (!afterSuccess) return; | 249 if (!afterSuccess) return; |
| 250 |
| 251 // However, users don't think of load tests as "tests", so the error isn't |
| 252 // helpful for them. |
| 253 // |
| 254 // TODO(nweiz): Find a way of avoiding this error that doesn't require |
| 255 // Invoker to refer to a class from the runner. |
| 256 if (liveTest.suite is LoadSuite) return; |
| 257 |
249 _handleError( | 258 _handleError( |
250 "This test failed after it had already completed. Make sure to use " | 259 "This test failed after it had already completed. Make sure to use " |
251 "[expectAsync]\n" | 260 "[expectAsync]\n" |
252 "or the [completes] matcher when testing async code.", | 261 "or the [completes] matcher when testing async code.", |
253 stackTrace); | 262 stackTrace); |
254 } | 263 } |
255 | 264 |
256 /// The method that's run when the test is started. | 265 /// The method that's run when the test is started. |
257 void _onRun() { | 266 void _onRun() { |
258 _controller.setState(const State(Status.running, Result.success)); | 267 _controller.setState(const State(Status.running, Result.success)); |
(...skipping 29 matching lines...) Expand all Loading... |
288 // outstanding callback counters at once. | 297 // outstanding callback counters at once. |
289 _counterKey: outstandingCallbacksForBody, | 298 _counterKey: outstandingCallbacksForBody, |
290 _closableKey: true | 299 _closableKey: true |
291 }, | 300 }, |
292 zoneSpecification: new ZoneSpecification( | 301 zoneSpecification: new ZoneSpecification( |
293 print: (self, parent, zone, line) => _controller.print(line)), | 302 print: (self, parent, zone, line) => _controller.print(line)), |
294 onError: _handleError); | 303 onError: _handleError); |
295 }); | 304 }); |
296 } | 305 } |
297 } | 306 } |
OLD | NEW |