// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. @TestOn('vm') library; import 'dart:io'; import 'dart:math' as math; import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:test_core/src/util/exit_codes.dart' as exit_codes; import 'package:test_descriptor/test_descriptor.dart' as d; import '../io.dart'; final _success = ''' import 'dart:async'; import 'package:test/test.dart'; void main() { test("success", () {}); } '''; final _failure = ''' import 'dart:async'; import 'package:test/test.dart'; void main() { test("failure", () => throw TestFailure("oh no")); } '''; final _asyncFailure = ''' import 'dart:async'; import 'package:test/test.dart'; void main() { test("failure", () async { await Future(() {}).then((_) { throw 'oh no'; }); }); } '''; final _defaultConcurrency = math.max(1, Platform.numberOfProcessors ~/ 2); final _usage = ''' Usage: dart test [files or directories...] -h, --help Show this usage information. --version Show the package:test version. Selecting Tests: -n, --name A substring of the name of the test to run. Regular expression syntax is supported. If passed multiple times, tests must match all substrings. -N, --plain-name A plain-text substring of the name of the test to run. If passed multiple times, tests must match all substrings. -t, --tags Run only tests with all of the specified tags. Supports boolean selector syntax. -x, --exclude-tags Don't run tests with any of the specified tags. Supports boolean selector syntax. --[no-]run-skipped Run skipped tests instead of skipping them. Running Tests: -p, --platform The platform(s) on which to run the tests. $_runtimes. Each platform supports the following compilers: $_runtimeCompilers -c, --compiler The compiler(s) to use to run tests, supported compilers are [dart2js, dart2wasm, exe, kernel, source]. Each platform has a default compiler but may support other compilers. You can target a compiler to a specific platform using arguments of the following form [:]. If a platform is specified but no given compiler is supported for that platform, then it will use its default compiler. -P, --preset The configuration preset(s) to use. -j, --concurrency= The number of concurrent test suites run. (defaults to "$_defaultConcurrency") --total-shards The total number of invocations of the test runner being run. --shard-index The index of this test runner invocation (of --total-shards). --timeout The default test timeout. For example: 15s, 2x, none (defaults to "30s") --suite-load-timeout The timeout for loading a test suite. Loading the test suite includes compiling the test suite. For example: 15s, 2m, none (defaults to "none") --ignore-timeouts Ignore all timeouts (useful if debugging) --pause-after-load Pause for debugging before any tests execute. Implies --concurrency=1, --debug, and --ignore-timeouts. Currently only supported for browser tests. --debug Run the VM and Chrome tests in debug mode. --coverage= Gather coverage and output it to the specified directory. Implies --debug. --coverage-path= Gather coverage and output an lcov report to the specified file. Implies --debug. --branch-coverage Include branch coverage information in the coverage report. Must be paired with --coverage or --coverage-path. --coverage-package= A regular expression matching packages names to include in the coverage report (if coverage is enabled). If unset, matches the current package name. --[no-]chain-stack-traces Use chained stack traces to provide greater exception details especially for asynchronous code. It may be useful to disable to provide improved test performance but at the cost of debuggability. --no-retry Don't rerun tests that have retry set. --test-randomize-ordering-seed Use the specified seed to randomize the execution order of test cases. Must be a 32bit unsigned integer or "random". If "random", pick a random seed to use. If not passed, do not randomize test case execution order. --[no-]fail-fast Stop running tests after the first failure. Output: -r, --reporter=