File tree Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Expand file tree Collapse file tree 3 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -87,19 +87,26 @@ class Reporter {
87
87
}
88
88
89
89
void error (String message, {bool shout: false }) {
90
+ message = message ?? 'An error was encountered running the task.' ;
90
91
_log (stderr, colorRed (message), shout: shout);
91
92
}
92
93
93
94
void success (String message, {bool shout: false }) {
95
+ if (message == null ) {
96
+ return ;
97
+ }
94
98
log (colorGreen (message), shout: shout);
95
99
}
96
100
97
101
void warning (String message, {bool shout: false }) {
102
+ if (message == null ) {
103
+ return ;
104
+ }
98
105
_log (stderr, colorYellow (message), shout: shout);
99
106
}
100
107
101
108
String _colorMessage (AnsiPen pen, String message) =>
102
- color && message.isNotEmpty ? pen (message) : message;
109
+ color && message != null && message .isNotEmpty ? pen (message) : message;
103
110
104
111
void _log (IOSink sink, String message, {bool shout: false }) {
105
112
if (quiet && ! shout) return ;
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ TestTask test({
30
30
List <String > presets: const [],
31
31
List <String > testArgs: const [],
32
32
List <String > tests: const [],
33
+ List <String > buildArgs: const [],
33
34
}) {
34
35
final executable = 'pub' ;
35
36
final args = < String > [];
@@ -48,8 +49,9 @@ TestTask test({
48
49
'run' ,
49
50
'build_runner' ,
50
51
'test' ,
51
- '--' ,
52
52
]);
53
+ args.addAll (buildArgs);
54
+ args.add ('--' );
53
55
} else {
54
56
args.addAll (['run' , 'test' ]);
55
57
}
@@ -102,6 +104,14 @@ TestTask test({
102
104
process.exitCode.then ((code) {
103
105
if (task.successful == null ) {
104
106
task.successful = code <= 0 ;
107
+
108
+ if (! task.successful) {
109
+ task.testSummary = 'An error was encountered when running tests.' ;
110
+ }
111
+
112
+ if (! outputProcessed.isCompleted) {
113
+ outputProcessed.complete ();
114
+ }
105
115
}
106
116
});
107
117
Original file line number Diff line number Diff line change @@ -196,17 +196,6 @@ class TestCli extends TaskCli {
196
196
buildArgs.add ('--delete-conflicting-outputs' );
197
197
}
198
198
199
- if (dartMajorVersion == 2 && hasImmediateDependency ('build_test' )) {
200
- var args = ['run' , 'build_runner' , 'build' ]..addAll (buildArgs);
201
- final buildProcess = new TaskProcess ('pub' , args);
202
- reporter.logGroup ('pub run build_runner build' ,
203
- outputStream: buildProcess.stdout, errorStream: buildProcess.stderr);
204
- final buildExitCode = await buildProcess.exitCode;
205
- if (buildExitCode != 0 ) {
206
- return new CliResult .fail ('Build failed - cannot run tests.' );
207
- }
208
- }
209
-
210
199
PubServeTask pubServeTask;
211
200
212
201
if (pubServe) {
@@ -270,7 +259,8 @@ A pub serve instance will not be started.''');
270
259
concurrency: concurrency,
271
260
platforms: platforms,
272
261
presets: presets,
273
- testArgs: testArgs);
262
+ testArgs: testArgs,
263
+ buildArgs: buildArgs);
274
264
reporter.logGroup (task.testCommand, outputStream: task.testOutput);
275
265
276
266
await task.done;
You can’t perform that action at this time.
0 commit comments