Do not assume that pub is the first command run by "flutter create" (#114621)

The "flutter create" command on macOS may run other commands such as
openssl when it calls _getCodeSigningIdentityDevelopmentTeam
This commit is contained in:
Jason Simmons 2022-11-03 10:46:18 -07:00 committed by GitHub
parent 0943693e85
commit a440c4689f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1921,14 +1921,17 @@ void main() {
// Run pub online first in order to populate the pub cache.
await runner.run(<String>['create', '--pub', projectDir.path]);
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
expect(loggingProcessManager.commands.first, isNot(contains('--offline')));
final RegExp dartCommand = RegExp(r'dart-sdk[\\/]bin[\\/]dart');
expect(loggingProcessManager.commands, contains(predicate(
(List<String> c) => dartCommand.hasMatch(c[0]) && c[1].contains('pub') && !c.contains('--offline')
)));
// Run pub offline.
loggingProcessManager.clear();
await runner.run(<String>['create', '--pub', '--offline', projectDir.path]);
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
expect(loggingProcessManager.commands.first, contains('--offline'));
expect(loggingProcessManager.commands, contains(predicate(
(List<String> c) => dartCommand.hasMatch(c[0]) && c[1].contains('pub') && c.contains('--offline')
)));
},
overrides: <Type, Generator>{
ProcessManager: () => loggingProcessManager,