ensure no pub output while caching PubDependencies artifact (#121831)
[flutter_tools] ensure no pub output while caching PubDependencies artifact
This commit is contained in:
committed by
GitHub
parent
0d9a0207ad
commit
902dac4763
@@ -127,7 +127,8 @@ class PubDependencies extends ArtifactSet {
|
||||
project: _projectFactory.fromDirectory(
|
||||
fileSystem.directory(fileSystem.path.join(_flutterRoot(), 'packages', 'flutter_tools'))
|
||||
),
|
||||
offline: offline
|
||||
offline: offline,
|
||||
outputMode: PubOutputMode.none,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -978,6 +978,13 @@ void main() {
|
||||
await pubDependencies.update(FakeArtifactUpdater(), logger, fileSystem, FakeOperatingSystemUtils());
|
||||
|
||||
expect(pub.calledGet, 1);
|
||||
expect(
|
||||
pub.invocations.first,
|
||||
predicate<FakePubInvocation>(
|
||||
(FakePubInvocation invocation) => invocation.outputMode == PubOutputMode.none,
|
||||
'Pub invoked with PubOutputMode.none',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testUsingContext('Check current DevTools version', () async {
|
||||
@@ -1172,8 +1179,17 @@ class FakeVersionedPackageResolver extends Fake implements VersionedPackageResol
|
||||
}
|
||||
}
|
||||
|
||||
class FakePubInvocation {
|
||||
FakePubInvocation({
|
||||
required this.outputMode,
|
||||
});
|
||||
|
||||
final PubOutputMode outputMode;
|
||||
}
|
||||
|
||||
class FakePub extends Fake implements Pub {
|
||||
int calledGet = 0;
|
||||
final List<FakePubInvocation> invocations = <FakePubInvocation>[];
|
||||
int get calledGet => invocations.length;
|
||||
|
||||
@override
|
||||
Future<void> get({
|
||||
@@ -1188,7 +1204,7 @@ class FakePub extends Fake implements Pub {
|
||||
bool printProgress = true,
|
||||
PubOutputMode outputMode = PubOutputMode.all,
|
||||
}) async {
|
||||
calledGet += 1;
|
||||
invocations.add(FakePubInvocation(outputMode: outputMode));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user