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

Side by Side Diff: test/runner/json_reporter_test.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, 5 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 | « test/runner/compact_reporter_test.dart ('k') | test/runner/loader_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 @TestOn("vm") 5 @TestOn("vm")
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 import 'package:scheduled_test/descriptor.dart' as d; 10 import 'package:scheduled_test/descriptor.dart' as d;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 test('skip 1', () {}, skip: 'some reason'); 380 test('skip 1', () {}, skip: 'some reason');
381 test('skip 2', () {}, skip: 'or another'); 381 test('skip 2', () {}, skip: 'or another');
382 """, [ 382 """, [
383 _start, 383 _start,
384 _allSuites(), 384 _allSuites(),
385 _suite(0), 385 _suite(0),
386 _testStart(1, "loading test.dart", groupIDs: []), 386 _testStart(1, "loading test.dart", groupIDs: []),
387 _testDone(1, hidden: true), 387 _testDone(1, hidden: true),
388 _group(2, testCount: 2), 388 _group(2, testCount: 2),
389 _testStart(3, "skip 1", skip: "some reason", line: 6, column: 9), 389 _testStart(3, "skip 1", skip: "some reason", line: 6, column: 9),
390 _print(3, "Skip: some reason", type: "skip"),
390 _testDone(3, skipped: true), 391 _testDone(3, skipped: true),
391 _testStart(4, "skip 2", skip: "or another", line: 7, column: 9), 392 _testStart(4, "skip 2", skip: "or another", line: 7, column: 9),
393 _print(4, "Skip: or another", type: "skip"),
392 _testDone(4, skipped: true), 394 _testDone(4, skipped: true),
393 _done() 395 _done()
394 ]); 396 ]);
395 }); 397 });
396 }); 398 });
397 399
398 group("reports line and column numbers for", () { 400 group("reports line and column numbers for", () {
399 test("the first call to setUpAll()", () { 401 test("the first call to setUpAll()", () {
400 _expectReport(""" 402 _expectReport("""
401 setUpAll(() {}); 403 setUpAll(() {});
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 "line": line, 597 "line": line,
596 "column": column, 598 "column": column,
597 "url": 599 "url":
598 line == null ? null : p.toUri(p.join(sandbox, "test.dart")).toString() 600 line == null ? null : p.toUri(p.join(sandbox, "test.dart")).toString()
599 } 601 }
600 }; 602 };
601 } 603 }
602 604
603 /// Returns the event emitted by the JSON reporter indicating that a test 605 /// Returns the event emitted by the JSON reporter indicating that a test
604 /// printed [message]. 606 /// printed [message].
605 Map _print(int id, String message) { 607 Map _print(int id, String message, {String type}) {
606 return { 608 return {
607 "type": "print", 609 "type": "print",
608 "testID": id, 610 "testID": id,
609 "message": message 611 "message": message,
612 "messageType": type ?? "print"
610 }; 613 };
611 } 614 }
612 615
613 /// Returns the event emitted by the JSON reporter indicating that a test 616 /// Returns the event emitted by the JSON reporter indicating that a test
614 /// emitted [error]. 617 /// emitted [error].
615 /// 618 ///
616 /// The [isFailure] parameter indicates whether the error was a [TestFailure] or 619 /// The [isFailure] parameter indicates whether the error was a [TestFailure] or
617 /// not. 620 /// not.
618 Map _error(int id, String error, {bool isFailure: false}) { 621 Map _error(int id, String error, {bool isFailure: false}) {
619 return { 622 return {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 /// Returns the serialized metadata corresponding to [skip]. 655 /// Returns the serialized metadata corresponding to [skip].
653 Map _metadata({skip}) { 656 Map _metadata({skip}) {
654 if (skip == true) { 657 if (skip == true) {
655 return {"skip": true, "skipReason": null}; 658 return {"skip": true, "skipReason": null};
656 } else if (skip is String) { 659 } else if (skip is String) {
657 return {"skip": true, "skipReason": skip}; 660 return {"skip": true, "skipReason": skip};
658 } else { 661 } else {
659 return {"skip": false, "skipReason": null}; 662 return {"skip": false, "skipReason": null};
660 } 663 }
661 } 664 }
OLDNEW
« no previous file with comments | « test/runner/compact_reporter_test.dart ('k') | test/runner/loader_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698