OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 """).create(); | 65 """).create(); |
66 | 66 |
67 var test = runTest(["-p", "chrome", "--verbose-trace", "test.dart"]); | 67 var test = runTest(["-p", "chrome", "--verbose-trace", "test.dart"]); |
68 test.stdout.fork().expect(never(endsWith(" main.<fn>"))); | 68 test.stdout.fork().expect(never(endsWith(" main.<fn>"))); |
69 test.stdout.fork().expect(never(contains("package:test"))); | 69 test.stdout.fork().expect(never(contains("package:test"))); |
70 test.stdout.fork().expect(never(contains("dart:async/zone.dart"))); | 70 test.stdout.fork().expect(never(contains("dart:async/zone.dart"))); |
71 test.stdout.expect(consumeThrough(contains("-1: Some tests failed."))); | 71 test.stdout.expect(consumeThrough(contains("-1: Some tests failed."))); |
72 test.shouldExit(1); | 72 test.shouldExit(1); |
73 }, tags: 'chrome'); | 73 }, tags: 'chrome'); |
74 | 74 |
| 75 test("skips tests with skip: true", () { |
| 76 d.file("dart_test.yaml", JSON.encode({ |
| 77 "skip": true |
| 78 })).create(); |
| 79 |
| 80 d.file("test.dart", """ |
| 81 import 'package:test/test.dart'; |
| 82 |
| 83 void main() { |
| 84 test("test", () {}); |
| 85 } |
| 86 """).create(); |
| 87 |
| 88 var test = runTest(["test.dart"]); |
| 89 test.stdout.expect(consumeThrough(contains('All tests skipped.'))); |
| 90 test.shouldExit(0); |
| 91 }); |
| 92 |
| 93 test("skips tests with skip: reason", () { |
| 94 d.file("dart_test.yaml", JSON.encode({ |
| 95 "skip": "Tests are boring." |
| 96 })).create(); |
| 97 |
| 98 d.file("test.dart", """ |
| 99 import 'package:test/test.dart'; |
| 100 |
| 101 void main() { |
| 102 test("test", () {}); |
| 103 } |
| 104 """).create(); |
| 105 |
| 106 var test = runTest(["test.dart"]); |
| 107 test.stdout.expect(consumeThrough(contains('Tests are boring.'))); |
| 108 test.stdout.expect(consumeThrough(contains('All tests skipped.'))); |
| 109 test.shouldExit(0); |
| 110 }); |
| 111 |
| 112 test("runs tests on a platform that matches test_on", () { |
| 113 d.file("dart_test.yaml", JSON.encode({ |
| 114 "test_on": "vm" |
| 115 })).create(); |
| 116 |
| 117 d.file("test.dart", """ |
| 118 import 'package:test/test.dart'; |
| 119 |
| 120 void main() { |
| 121 test("test", () {}); |
| 122 } |
| 123 """).create(); |
| 124 |
| 125 var test = runTest(["test.dart"]); |
| 126 test.stdout.expect(consumeThrough(contains('All tests passed!'))); |
| 127 test.shouldExit(0); |
| 128 }); |
| 129 |
| 130 test("doesn't run tests on a platform that doesn't match test_on", () { |
| 131 d.file("dart_test.yaml", JSON.encode({ |
| 132 "test_on": "chrome" |
| 133 })).create(); |
| 134 |
| 135 d.file("test.dart", """ |
| 136 import 'package:test/test.dart'; |
| 137 |
| 138 void main() { |
| 139 test("test", () {}); |
| 140 } |
| 141 """).create(); |
| 142 |
| 143 var test = runTest(["test.dart"]); |
| 144 test.stdout.expect(consumeThrough(contains('No tests ran.'))); |
| 145 test.shouldExit(0); |
| 146 }); |
| 147 |
75 test("uses the specified reporter", () { | 148 test("uses the specified reporter", () { |
76 d.file("dart_test.yaml", JSON.encode({ | 149 d.file("dart_test.yaml", JSON.encode({ |
77 "reporter": "json" | 150 "reporter": "json" |
78 })).create(); | 151 })).create(); |
79 | 152 |
80 d.file("test.dart", """ | 153 d.file("test.dart", """ |
81 import 'package:test/test.dart'; | 154 import 'package:test/test.dart'; |
82 | 155 |
83 void main() { | 156 void main() { |
84 test("success", () {}); | 157 test("success", () {}); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 test("failure", () => throw "oh no"); | 374 test("failure", () => throw "oh no"); |
302 } | 375 } |
303 """) | 376 """) |
304 ]).create(); | 377 ]).create(); |
305 | 378 |
306 var test = runTest([]); | 379 var test = runTest([]); |
307 test.stdout.expect(consumeThrough(contains('All tests passed!'))); | 380 test.stdout.expect(consumeThrough(contains('All tests passed!'))); |
308 test.shouldExit(0); | 381 test.shouldExit(0); |
309 }); | 382 }); |
310 } | 383 } |
OLD | NEW |