mirror of
https://github.com/flutter/flutter
synced 2024-10-12 19:23:02 +00:00
[flutter_tools] always build test assets (#81341)
This commit is contained in:
parent
1575537ac4
commit
aecd5e0302
|
@ -315,7 +315,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
|
|||
);
|
||||
}
|
||||
|
||||
if (buildTestAssets && flutterProject.manifest.assets.isNotEmpty) {
|
||||
if (buildTestAssets) {
|
||||
await _buildTestAsset();
|
||||
}
|
||||
|
||||
|
|
|
@ -604,6 +604,47 @@ dev_dependencies:
|
|||
FakeDevice('ephemeral', 'ephemeral', ephemeral: true, isSupported: true, type: PlatformType.android),
|
||||
]),
|
||||
});
|
||||
|
||||
testUsingContext('Builds the asset manifest by default', () async {
|
||||
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0);
|
||||
|
||||
final TestCommand testCommand = TestCommand(testRunner: testRunner);
|
||||
final CommandRunner<void> commandRunner = createTestCommandRunner(testCommand);
|
||||
|
||||
await commandRunner.run(const <String>[
|
||||
'test',
|
||||
'--no-pub',
|
||||
]);
|
||||
|
||||
final bool fileExists = await fs.isFile('build/unit_test_assets/AssetManifest.json');
|
||||
expect(fileExists, true);
|
||||
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
DeviceManager: () => _FakeDeviceManager(<Device>[]),
|
||||
});
|
||||
|
||||
testUsingContext('Don\'t build the asset manifest if --no-test-assets if informed', () async {
|
||||
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0);
|
||||
|
||||
final TestCommand testCommand = TestCommand(testRunner: testRunner);
|
||||
final CommandRunner<void> commandRunner = createTestCommandRunner(testCommand);
|
||||
|
||||
await commandRunner.run(const <String>[
|
||||
'test',
|
||||
'--no-pub',
|
||||
'--no-test-assets',
|
||||
]);
|
||||
|
||||
final bool fileExists = await fs.isFile('build/unit_test_assets/AssetManifest.json');
|
||||
expect(fileExists, false);
|
||||
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fs,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
DeviceManager: () => _FakeDeviceManager(<Device>[]),
|
||||
});
|
||||
}
|
||||
|
||||
class FakeFlutterTestRunner implements FlutterTestRunner {
|
||||
|
|
Loading…
Reference in a new issue