mirror of
https://github.com/flutter/packages.git
synced 2025-06-11 07:07:51 +08:00
Fix publish-check output (#3953)
This commit is contained in:
@ -175,7 +175,10 @@ class PublishCheckCommand extends PluginCommand {
|
|||||||
(List<int> event) {
|
(List<int> event) {
|
||||||
final String output = String.fromCharCodes(event);
|
final String output = String.fromCharCodes(event);
|
||||||
if (output.isNotEmpty) {
|
if (output.isNotEmpty) {
|
||||||
_printImportantStatusMessage(output, isError: true);
|
// The final result is always printed on stderr, whether success or
|
||||||
|
// failure.
|
||||||
|
final bool isError = !output.contains('has 0 warnings');
|
||||||
|
_printImportantStatusMessage(output, isError: isError);
|
||||||
outputBuffer.write(output);
|
outputBuffer.write(output);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -132,6 +132,26 @@ void main() {
|
|||||||
expect(runner.run(<String>['publish-check']), throwsA(isA<ToolExit>()));
|
expect(runner.run(<String>['publish-check']), throwsA(isA<ToolExit>()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Success message on stderr is not printed as an error', () async {
|
||||||
|
createFakePlugin('d');
|
||||||
|
|
||||||
|
const String publishOutput = 'Package has 0 warnings.';
|
||||||
|
|
||||||
|
final MockProcess process = MockProcess();
|
||||||
|
process.stderrController.add(publishOutput.codeUnits);
|
||||||
|
process.stdoutController.close(); // ignore: unawaited_futures
|
||||||
|
process.stderrController.close(); // ignore: unawaited_futures
|
||||||
|
|
||||||
|
process.exitCodeCompleter.complete(0);
|
||||||
|
|
||||||
|
processRunner.processesToReturn.add(process);
|
||||||
|
|
||||||
|
final List<String> output = await runCapturingPrint(
|
||||||
|
runner, <String>['publish-check']);
|
||||||
|
|
||||||
|
expect(output, isNot(contains(contains('ERROR:'))));
|
||||||
|
});
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'--machine: Log JSON with status:no-publish and correct human message, if there are no packages need to be published. ',
|
'--machine: Log JSON with status:no-publish and correct human message, if there are no packages need to be published. ',
|
||||||
() async {
|
() async {
|
||||||
|
Reference in New Issue
Block a user