mirror of
https://github.com/flutter/packages.git
synced 2025-08-16 21:16:16 +08:00
[flutter_plugin_tools] Run pub get for custom-test (#5322)
When running a Dart test script for `custom-test`, `pub get` needs to be run first in order for it to work in a clean environment such as CI. This will unblock enabling Pigeon's Dart tests in flutter/packages.
This commit is contained in:
@ -43,10 +43,19 @@ class CustomTestCommand extends PackageLoopingCommand {
|
||||
|
||||
// Run the custom Dart script if presest.
|
||||
if (script.existsSync()) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
// Ensure that dependencies are available.
|
||||
final int pubGetExitCode = await processRunner.runAndStream(
|
||||
'dart', <String>['pub', 'get'],
|
||||
workingDir: package.directory);
|
||||
if (pubGetExitCode != 0) {
|
||||
return PackageResult.fail(
|
||||
<String>['Unable to get script dependencies']);
|
||||
}
|
||||
|
||||
final int testExitCode = await processRunner.runAndStream(
|
||||
'dart', <String>['run', 'tool/$_scriptName'],
|
||||
workingDir: package.directory);
|
||||
if (exitCode != 0) {
|
||||
if (testExitCode != 0) {
|
||||
return PackageResult.fail();
|
||||
}
|
||||
ranTests = true;
|
||||
|
Reference in New Issue
Block a user