-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[flutter_plugin_tools] Run pub get for custom-test #5322
[flutter_plugin_tools] Run pub get for custom-test #5322
Conversation
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.
@@ -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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runAndStream
prints to stdout and stderr? If so this looks good. If not we should make sure we output that information when the exit code != 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's what the "AndStream" is supposed to capturing:
/// Run the [executable] with [args] and stream output to stderr and stdout.
MockProcess(exitCode: 0), // pub get | ||
MockProcess(exitCode: 1), // test script |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fragile. It would be nice if mockProcessesForExecutable was a Map<String, List<Process>>
Where the key is the name of the process and the value is a list to handle multiple invocations of the same process. No need to fix it here if it is a lot of work, just wanted to call it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fragile.
Indeed, it's been on my list to get back to at some point.
It would be nice if mockProcessesForExecutable was a
Map<String, List<Process>>
Where the key is the name of the process and the value is a list to handle multiple invocations of the same process.
That's exactly what it is, actually (now; it used to just be a List<Process>
, and this was the incremental improvement I made a while back because that was very fragile, and seriously impaired my ability to build out meaningful test coverage of the tool during that effort). The problem that's left is that it's using a list instead of an argument matcher, so we can't distinguish between dart pub get
and dart run tool/run_tests.dart
, and still have to handle that positionally instead.
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.
When running a Dart test script for
custom-test
,pub get
needs to berun 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.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).