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 @TestOn("vm") | 5 @TestOn("vm") |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
9 | 9 |
10 import 'package:scheduled_test/descriptor.dart' as d; | 10 import 'package:scheduled_test/descriptor.dart' as d; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 -N, --plain-name A plain-text substring of the name of the test to
run. | 55 -N, --plain-name A plain-text substring of the name of the test to
run. |
56 If passed multiple times, tests must match all su
bstrings. | 56 If passed multiple times, tests must match all su
bstrings. |
57 | 57 |
58 -t, --tags Run only tests with all of the specified tags. | 58 -t, --tags Run only tests with all of the specified tags. |
59 Supports boolean selector syntax. | 59 Supports boolean selector syntax. |
60 | 60 |
61 -x, --exclude-tags Don't run tests with any of the specified tags. | 61 -x, --exclude-tags Don't run tests with any of the specified tags. |
62 Supports boolean selector syntax. | 62 Supports boolean selector syntax. |
63 | 63 |
| 64 --[no-]run-skipped Run skipped tests instead of skipping them. |
| 65 |
64 ======== Running Tests | 66 ======== Running Tests |
65 -p, --platform The platform(s) on which to run the tests. | 67 -p, --platform The platform(s) on which to run the tests. |
66 $_browsers | 68 $_browsers |
67 | 69 |
68 -P, --preset The configuration preset(s) to use. | 70 -P, --preset The configuration preset(s) to use. |
69 -j, --concurrency=<threads> The number of concurrent test suites run. | 71 -j, --concurrency=<threads> The number of concurrent test suites run. |
70 (defaults to "$_defaultConcurrency") | 72 (defaults to "$_defaultConcurrency") |
71 | 73 |
72 --pub-serve=<port> The port of a pub serve instance serving "test/". | 74 --pub-serve=<port> The port of a pub serve instance serving "test/". |
73 --timeout The default test timeout. For example: 15s, 2x, n
one | 75 --timeout The default test timeout. For example: 15s, 2x, n
one |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 }); | 354 }); |
353 | 355 |
354 test("runs tests even when a file fails to load", () { | 356 test("runs tests even when a file fails to load", () { |
355 d.file("test.dart", _success).create(); | 357 d.file("test.dart", _success).create(); |
356 | 358 |
357 var test = runTest(["test.dart", "nonexistent.dart"]); | 359 var test = runTest(["test.dart", "nonexistent.dart"]); |
358 test.stdout.expect(consumeThrough(contains("+1 -1: Some tests failed."))); | 360 test.stdout.expect(consumeThrough(contains("+1 -1: Some tests failed."))); |
359 test.shouldExit(1); | 361 test.shouldExit(1); |
360 }); | 362 }); |
361 | 363 |
362 test("respects top-level @Skip declarations", () { | 364 group("with a top-level @Skip declaration", () { |
363 d.file("test.dart", ''' | 365 setUp(() { |
364 @Skip() | 366 d.file("test.dart", ''' |
| 367 @Skip() |
365 | 368 |
366 import 'dart:async'; | 369 import 'dart:async'; |
367 | 370 |
368 import 'package:test/test.dart'; | 371 import 'package:test/test.dart'; |
369 | 372 |
370 void main() { | 373 void main() { |
371 test("fail", () => throw 'oh no'); | 374 test("success", () {}); |
372 } | 375 } |
373 ''').create(); | 376 ''').create(); |
| 377 }); |
374 | 378 |
375 var test = runTest(["test.dart"]); | 379 test("skips all tests", () { |
376 test.stdout.expect(consumeThrough(contains("+0 ~1: All tests skipped."))); | 380 var test = runTest(["test.dart"]); |
377 test.shouldExit(0); | 381 test.stdout.expect(consumeThrough(contains("+0 ~1: All tests skipped."))); |
| 382 test.shouldExit(0); |
| 383 }); |
| 384 |
| 385 test("runs all tests with --run-skipped", () { |
| 386 var test = runTest(["--run-skipped", "test.dart"]); |
| 387 test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); |
| 388 test.shouldExit(0); |
| 389 }); |
378 }); | 390 }); |
379 | 391 |
380 group("with onPlatform", () { | 392 group("with onPlatform", () { |
381 test("respects matching Skips", () { | 393 test("respects matching Skips", () { |
382 d.file("test.dart", ''' | 394 d.file("test.dart", ''' |
383 import 'dart:async'; | 395 import 'dart:async'; |
384 | 396 |
385 import 'package:test/test.dart'; | 397 import 'package:test/test.dart'; |
386 | 398 |
387 void main() { | 399 void main() { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 }); | 576 }); |
565 | 577 |
566 test("with the --color flag, uses colors", () { | 578 test("with the --color flag, uses colors", () { |
567 d.file("test.dart", _failure).create(); | 579 d.file("test.dart", _failure).create(); |
568 var test = runTest(["--color", "test.dart"]); | 580 var test = runTest(["--color", "test.dart"]); |
569 // This is the color code for red. | 581 // This is the color code for red. |
570 test.stdout.expect(consumeThrough(contains("\u001b[31m"))); | 582 test.stdout.expect(consumeThrough(contains("\u001b[31m"))); |
571 test.shouldExit(); | 583 test.shouldExit(); |
572 }); | 584 }); |
573 } | 585 } |
OLD | NEW |