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

Side by Side Diff: test/runner/configuration/global_test.dart

Issue 1829483002: Add support for a global configuration file. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 9 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 | « lib/src/runner/configuration/load.dart ('k') | test/runner/configuration/top_level_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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 @TestOn("vm")
6
7 import 'dart:convert';
8
9 import 'package:scheduled_test/descriptor.dart' as d;
10 import 'package:scheduled_test/scheduled_stream.dart';
11 import 'package:scheduled_test/scheduled_test.dart';
12
13 import 'package:test/src/util/exit_codes.dart' as exit_codes;
14
15 import '../../io.dart';
16
17 void main() {
18 useSandbox();
19
20 test("ignores an empty file", () {
21 d.file("global_test.yaml", "").create();
22
23 d.file("test.dart", """
24 import 'package:test/test.dart';
25
26 void main() {
27 test("success", () {});
28 }
29 """).create();
30
31 var test = runTest(["test.dart"], environment: {
32 "DART_TEST_CONFIG": "global_test.yaml"
33 });
34 test.stdout.expect(consumeThrough(contains("+1: All tests passed!")));
35 test.shouldExit(0);
36 });
37
38 test("uses supported test configuration", () {
39 d.file("global_test.yaml", JSON.encode({
40 "verbose_trace": true
41 })).create();
42
43 d.file("test.dart", """
44 import 'package:test/test.dart';
45
46 void main() {
47 test("failure", () => throw "oh no");
48 }
49 """).create();
50
51 var test = runTest(["test.dart"], environment: {
52 "DART_TEST_CONFIG": "global_test.yaml"
53 });
54 test.stdout.expect(consumeThrough(contains("dart:isolate-patch")));
55 test.shouldExit(1);
56 });
57
58 test("uses supported runner configuration", () {
59 d.file("global_test.yaml", JSON.encode({
60 "reporter": "json"
61 })).create();
62
63 d.file("test.dart", """
64 import 'package:test/test.dart';
65
66 void main() {
67 test("success", () {});
68 }
69 """).create();
70
71 var test = runTest(["test.dart"], environment: {
72 "DART_TEST_CONFIG": "global_test.yaml"
73 });
74 test.stdout.expect(consumeThrough(contains('"testStart"')));
75 test.shouldExit(0);
76 });
77
78 test("local configuration takes precedence", () {
79 d.file("global_test.yaml", JSON.encode({
80 "verbose_trace": true
81 })).create();
82
83 d.file("dart_test.yaml", JSON.encode({
84 "verbose_trace": false
85 })).create();
86
87 d.file("test.dart", """
88 import 'package:test/test.dart';
89
90 void main() {
91 test("failure", () => throw "oh no");
92 }
93 """).create();
94
95 var test = runTest(["test.dart"], environment: {
96 "DART_TEST_CONFIG": "global_test.yaml"
97 });
98 test.stdout.expect(never(contains("dart:isolate-patch")));
99 test.shouldExit(1);
100 });
101
102 group("disallows local-only configuration:", () {
103 for (var field in ["skip", "test_on", "paths", "filename", "names",
104 "plain_names", "include_tags", "exclude_tags", "pub_serve", "tags",
105 "add_tags"]) {
106 test("rejects local-only configuration", () {
107 d.file("global_test.yaml", JSON.encode({field: null})).create();
108
109 d.file("test.dart", """
110 import 'package:test/test.dart';
111
112 void main() {
113 test("success", () {});
114 }
115 """).create();
116
117 var test = runTest(["test.dart"], environment: {
118 "DART_TEST_CONFIG": "global_test.yaml"
119 });
120 test.stderr.expect(containsInOrder([
121 "of global_test.yaml: $field isn't supported here.",
122 "^^"
123 ]));
124 test.shouldExit(exit_codes.data);
125 });
126 }
127 });
128 }
OLDNEW
« no previous file with comments | « lib/src/runner/configuration/load.dart ('k') | test/runner/configuration/top_level_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698