Don't load test suites with excluded tags (#758)
Closes #753
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ed8fb5..025de77 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.12.30+2
+
+* Avoid loading test suites whose tags are excluded by `--excluded-tags`.
+
## 0.12.30+1
* Internal changes.
diff --git a/lib/src/runner/loader.dart b/lib/src/runner/loader.dart
index 31b1a99..fd9929e 100644
--- a/lib/src/runner/loader.dart
+++ b/lib/src/runner/loader.dart
@@ -211,6 +211,10 @@
return;
}
+ if (_config.suiteDefaults.excludeTags.evaluate(suiteConfig.metadata.tags)) {
+ return;
+ }
+
if (_config.pubServeUrl != null && !p.isWithin('test', path)) {
yield new LoadSuite.forLoadException(
new LoadException(
diff --git a/pubspec.yaml b/pubspec.yaml
index 80f14c1..85f5d37 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: test
-version: 0.12.30+1
+version: 0.12.30+2
author: Dart Team <misc@dartlang.org>
description: A library for writing dart unit tests.
homepage: https://github.com/dart-lang/test
diff --git a/test/runner/tag_test.dart b/test/runner/tag_test.dart
index 8f5484f..992c589 100644
--- a/test/runner/tag_test.dart
+++ b/test/runner/tag_test.dart
@@ -97,6 +97,22 @@
await test.shouldExit(0);
});
+ test("dosn't load a suite with an excluded tag", () async {
+ await d.file("test.dart", """
+ @Tags(const ["a"])
+
+ import 'package:test/test.dart';
+
+ void main() {
+ throw "error";
+ }
+ """).create();
+
+ var test = await runTest(["--exclude-tags=a", "test.dart"]);
+ expect(test.stdout, emits("No tests ran."));
+ await test.shouldExit(0);
+ });
+
test("allows unused tags", () async {
var test = await runTest(["--exclude-tags=b,z", "test.dart"]);
expect(test.stdout, tagWarnings(['a', 'c']));