@@ -91,15 +91,20 @@ void main() {
91
91
test ('invalid parameters return non-zero and print a fatal-error' ,
92
92
() async {
93
93
var outputLines = < String > [];
94
- await expectLater (
95
- () => subprocessLauncher.runStreamed (
96
- Platform .resolvedExecutable,
97
- [
98
- dartdocPath,
99
- '--nonexisting' ,
100
- ],
101
- perLine: outputLines.add),
102
- throwsA (const TypeMatcher <ProcessException >()));
94
+ var threwException = false ;
95
+ // consider [expectLater] when it works reliably with coverage again.
96
+ try {
97
+ await subprocessLauncher.runStreamed (
98
+ Platform .resolvedExecutable,
99
+ [
100
+ dartdocPath,
101
+ '--nonexisting' ,
102
+ ],
103
+ perLine: outputLines.add);
104
+ } on ProcessException {
105
+ threwException = true ;
106
+ }
107
+ expect (threwException, isTrue);
103
108
expect (
104
109
outputLines.firstWhere ((l) => l.startsWith (' fatal' )),
105
110
equals (
@@ -109,31 +114,41 @@ void main() {
109
114
test ('missing a required file path prints a fatal-error' , () async {
110
115
var outputLines = < String > [];
111
116
var impossiblePath = path.join (dartdocPath, 'impossible' );
112
- await expectLater (
113
- () => subprocessLauncher.runStreamed (
114
- Platform .resolvedExecutable,
115
- [
116
- dartdocPath,
117
- '--input' ,
118
- impossiblePath,
119
- ],
120
- perLine: outputLines.add),
121
- throwsA (const TypeMatcher <ProcessException >()));
117
+ var threwException = false ;
118
+ // consider [expectLater] when it works with coverage again.
119
+ try {
120
+ await subprocessLauncher.runStreamed (
121
+ Platform .resolvedExecutable,
122
+ [
123
+ dartdocPath,
124
+ '--input' ,
125
+ impossiblePath,
126
+ ],
127
+ perLine: outputLines.add);
128
+ } on ProcessException {
129
+ threwException = true ;
130
+ }
131
+ expect (threwException, isTrue);
122
132
expect (
123
133
outputLines.firstWhere ((l) => l.startsWith (' fatal' )),
124
134
startsWith (
125
135
' fatal error: Argument --input, set to $impossiblePath , resolves to missing path: ' ));
126
136
});
127
137
128
138
test ('errors cause non-zero exit when warnings are off' , () async {
129
- expect (
130
- () => subprocessLauncher.runStreamed (Platform .resolvedExecutable, [
131
- dartdocPath,
132
- '--allow-tools' ,
133
- '--input=${testPackageToolError .path }' ,
134
- '--output=${path .join (tempDir .absolute .path , 'test_package_tool_error' )}'
135
- ]),
136
- throwsA (const TypeMatcher <ProcessException >()));
139
+ // consider [expectLater] when it works with coverage.
140
+ var exceptionThrown = false ;
141
+ try {
142
+ await subprocessLauncher.runStreamed (Platform .resolvedExecutable, [
143
+ dartdocPath,
144
+ '--allow-tools' ,
145
+ '--input=${testPackageToolError .path }' ,
146
+ '--output=${path .join (tempDir .absolute .path , 'test_package_tool_error' )}'
147
+ ]);
148
+ } on ProcessException {
149
+ exceptionThrown = true ;
150
+ }
151
+ expect (exceptionThrown, isTrue);
137
152
});
138
153
139
154
test ('help prints command line args' , () async {
@@ -156,19 +171,20 @@ void main() {
156
171
var dartTool =
157
172
Directory (path.join (_testPackageFlutterPluginPath, '.dart_tool' ));
158
173
if (dartTool.existsSync ()) dartTool.deleteSync (recursive: true );
159
- Future run = subprocessLauncher.runStreamed (
160
- Platform .resolvedExecutable, args,
161
- environment: Map .from (Platform .environment)..remove ('FLUTTER_ROOT' ),
162
- includeParentEnvironment: false ,
163
- workingDirectory: _testPackageFlutterPluginPath, perLine: (s) {
164
- output.writeln (s);
165
- });
166
- // Asynchronous exception, but we still need the output, too.
167
- expect (run, throwsA (TypeMatcher <ProcessException >()));
174
+ var exceptionThrown = false ;
175
+ // consider [expectLater] when this works with coverage
168
176
try {
169
- await run;
170
- } on ProcessException catch (_) {}
171
-
177
+ await subprocessLauncher.runStreamed (Platform .resolvedExecutable, args,
178
+ environment: Map .from (Platform .environment)..remove ('FLUTTER_ROOT' ),
179
+ includeParentEnvironment: false ,
180
+ workingDirectory: _testPackageFlutterPluginPath, perLine: (s) {
181
+ output.writeln (s);
182
+ });
183
+ } on ProcessException {
184
+ exceptionThrown = true ;
185
+ }
186
+ // Asynchronous exception, but we still need the output, too.
187
+ expect (exceptionThrown, isTrue);
172
188
expect (
173
189
output.toString (),
174
190
contains (RegExp (
0 commit comments