File tree 2 files changed +39
-1
lines changed
test/commands.shard/hermetic
2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -620,7 +620,10 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
620
620
return true ;
621
621
}
622
622
623
- for (final DevFSFileContent entry in entries.values.whereType <DevFSFileContent >()) {
623
+ final Iterable <DevFSFileContent > files = entries.values
624
+ .map ((AssetBundleEntry asset) => asset.content)
625
+ .whereType <DevFSFileContent >();
626
+ for (final DevFSFileContent entry in files) {
624
627
// Calling isModified to access file stats first in order for isModifiedAfter
625
628
// to work.
626
629
if (entry.isModified && entry.isModifiedAfter (lastModified)) {
Original file line number Diff line number Diff line change @@ -955,6 +955,41 @@ dev_dependencies:
955
955
DeviceManager : () => _FakeDeviceManager (< Device > []),
956
956
});
957
957
958
+ testUsingContext ('Rebuild the asset bundle if an asset file has changed since previous build' , () async {
959
+ final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner (0 );
960
+ fs.file ('asset.txt' ).writeAsStringSync ('1' );
961
+ fs.file ('pubspec.yaml' ).writeAsStringSync ('''
962
+ flutter:
963
+ assets:
964
+ - asset.txt
965
+ dev_dependencies:
966
+ flutter_test:
967
+ sdk: flutter
968
+ integration_test:
969
+ sdk: flutter''' );
970
+ final TestCommand testCommand = TestCommand (testRunner: testRunner);
971
+ final CommandRunner <void > commandRunner = createTestCommandRunner (testCommand);
972
+
973
+ await commandRunner.run (const < String > [
974
+ 'test' ,
975
+ '--no-pub' ,
976
+ ]);
977
+
978
+ fs.file ('asset.txt' ).writeAsStringSync ('2' );
979
+
980
+ await commandRunner.run (const < String > [
981
+ 'test' ,
982
+ '--no-pub' ,
983
+ ]);
984
+
985
+ final String fileContent = fs.file (globals.fs.path.join ('build' , 'unit_test_assets' , 'asset.txt' )).readAsStringSync ();
986
+ expect (fileContent, '2' );
987
+ }, overrides: < Type , Generator > {
988
+ FileSystem : () => fs,
989
+ ProcessManager : () => FakeProcessManager .empty (),
990
+ DeviceManager : () => _FakeDeviceManager (< Device > []),
991
+ });
992
+
958
993
group ('Fatal Logs' , () {
959
994
testUsingContext ("doesn't fail when --fatal-warnings is set and no warning output" , () async {
960
995
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner (0 );
You can’t perform that action at this time.
0 commit comments