Add CustomDimensions.commandRunIsTest (#124135)

This commit is contained in:
Michael Goderbauer
2023-04-05 09:30:36 -07:00
committed by GitHub
parent 0cfcdeec89
commit daaa32bc06
3 changed files with 47 additions and 0 deletions

View File

@@ -475,6 +475,7 @@ void main() {
'cd3': 'false', 'cd4': 'ios', 'cd22': 'iOS 13',
'cd23': 'debug', 'cd18': 'false', 'cd15': 'swift', 'cd31': 'true',
'cd57': 'usb',
'cd58': 'false',
})
)));
}, overrides: <Type, Generator>{
@@ -488,6 +489,41 @@ void main() {
Usage: () => usage,
});
testUsingContext('correctly reports tests to usage', () async {
fs.currentDirectory.childDirectory('test').childFile('widget_test.dart').createSync(recursive: true);
fs.currentDirectory.childDirectory('ios').childFile('AppDelegate.swift').createSync(recursive: true);
final RunCommand command = RunCommand();
final FakeDevice mockDevice = FakeDevice(sdkNameAndVersion: 'iOS 13')
..startAppSuccess = false;
testDeviceManager.devices = <Device>[mockDevice];
await expectToolExitLater(createTestCommandRunner(command).run(<String>[
'run',
'--no-pub',
'--no-hot',
'test/widget_test.dart',
]), isNull);
expect(usage.commands, contains(
TestUsageCommand('run', parameters: CustomDimensions.fromMap(<String, String>{
'cd3': 'false', 'cd4': 'ios', 'cd22': 'iOS 13',
'cd23': 'debug', 'cd18': 'false', 'cd15': 'swift', 'cd31': 'true',
'cd57': 'usb',
'cd58': 'true',
})),
));
}, overrides: <Type, Generator>{
AnsiTerminal: () => fakeTerminal,
Artifacts: () => artifacts,
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
DeviceManager: () => testDeviceManager,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
Stdio: () => FakeStdio(),
Usage: () => usage,
});
group('--machine', () {
testUsingContext('enables multidex by default', () async {
final DaemonCapturingRunCommand command = DaemonCapturingRunCommand();
@@ -745,6 +781,7 @@ void main() {
commandRunModeName: 'debug',
commandRunProjectModule: false,
commandRunProjectHostLanguage: '',
commandRunIsTest: false,
));
}, overrides: <Type, Generator>{
DeviceManager: () => testDeviceManager,
@@ -785,6 +822,7 @@ void main() {
commandRunProjectModule: false,
commandRunProjectHostLanguage: '',
commandRunIOSInterfaceType: 'usb',
commandRunIsTest: false,
));
}, overrides: <Type, Generator>{
DeviceManager: () => testDeviceManager,
@@ -828,6 +866,7 @@ void main() {
commandRunProjectModule: false,
commandRunProjectHostLanguage: '',
commandRunIOSInterfaceType: 'wireless',
commandRunIsTest: false,
));
}, overrides: <Type, Generator>{
DeviceManager: () => testDeviceManager,
@@ -871,6 +910,7 @@ void main() {
commandRunProjectModule: false,
commandRunProjectHostLanguage: '',
commandRunIOSInterfaceType: 'wireless',
commandRunIsTest: false,
));
}, overrides: <Type, Generator>{
DeviceManager: () => testDeviceManager,