Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: lib/src/runner/reporter/json.dart

Issue 2091173002: Add metadata to messages emitted by live tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/runner/reporter/expanded.dart ('k') | lib/src/runner/runner_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:convert'; 6 import 'dart:convert';
7 7
8 import '../../backend/group.dart'; 8 import '../../backend/group.dart';
9 import '../../backend/group_entry.dart'; 9 import '../../backend/group_entry.dart';
10 import '../../backend/live_test.dart'; 10 import '../../backend/live_test.dart';
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 }); 147 });
148 148
149 /// Convert the future to a stream so that the subscription can be paused or 149 /// Convert the future to a stream so that the subscription can be paused or
150 /// canceled. 150 /// canceled.
151 _subscriptions.add(liveTest.onComplete.asStream().listen((_) => 151 _subscriptions.add(liveTest.onComplete.asStream().listen((_) =>
152 _onComplete(liveTest))); 152 _onComplete(liveTest)));
153 153
154 _subscriptions.add(liveTest.onError.listen((error) => 154 _subscriptions.add(liveTest.onError.listen((error) =>
155 _onError(liveTest, error.error, error.stackTrace))); 155 _onError(liveTest, error.error, error.stackTrace)));
156 156
157 _subscriptions.add(liveTest.onPrint.listen((line) { 157 _subscriptions.add(liveTest.onMessage.listen((message) {
158 _emit("print", { 158 _emit("print", {
159 "testID": id, 159 "testID": id,
160 "message": line 160 "messageType": message.type.name,
161 "message": message.text
161 }); 162 });
162 })); 163 }));
163 } 164 }
164 165
165 /// Returns an ID for [suite]. 166 /// Returns an ID for [suite].
166 /// 167 ///
167 /// If [suite] doesn't have an ID yet, this assigns one and emits a new event 168 /// If [suite] doesn't have an ID yet, this assigns one and emits a new event
168 /// for that suite. 169 /// for that suite.
169 int _idForSuite(Suite suite) { 170 int _idForSuite(Suite suite) {
170 if (_suiteIDs.containsKey(suite)) return _suiteIDs[suite]; 171 if (_suiteIDs.containsKey(suite)) return _suiteIDs[suite];
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 GroupEntry entry, TestPlatform platform) { 275 GroupEntry entry, TestPlatform platform) {
275 var frame = entry.trace?.frames?.first; 276 var frame = entry.trace?.frames?.first;
276 if (!_jsLocations && platform.isJS) frame = null; 277 if (!_jsLocations && platform.isJS) frame = null;
277 278
278 map["line"] = frame?.line; 279 map["line"] = frame?.line;
279 map["column"] = frame?.column; 280 map["column"] = frame?.column;
280 map["url"] = frame?.uri?.toString(); 281 map["url"] = frame?.uri?.toString();
281 return map; 282 return map;
282 } 283 }
283 } 284 }
OLDNEW
« no previous file with comments | « lib/src/runner/reporter/expanded.dart ('k') | lib/src/runner/runner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698