File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
test/commands.shard/hermetic Expand file tree Collapse file tree 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 {
620620 return true ;
621621 }
622622
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) {
624627 // Calling isModified to access file stats first in order for isModifiedAfter
625628 // to work.
626629 if (entry.isModified && entry.isModifiedAfter (lastModified)) {
Original file line number Diff line number Diff line change @@ -955,6 +955,41 @@ dev_dependencies:
955955 DeviceManager : () => _FakeDeviceManager (< Device > []),
956956 });
957957
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+
958993 group ('Fatal Logs' , () {
959994 testUsingContext ("doesn't fail when --fatal-warnings is set and no warning output" , () async {
960995 final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner (0 );
You can’t perform that action at this time.
0 commit comments