fix(cli): migration tests (#7745)

This commit is contained in:
Lucas Fernandes Nogueira 2023-09-06 13:43:17 -03:00 committed by GitHub
parent 29818de682
commit 964282a267
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View File

@ -95,7 +95,7 @@ pub trait Interface: Sized {
options: Options,
on_exit: F,
) -> crate::Result<()>;
fn mobile_dev<R: Fn(MobileOptions) -> crate::Result<Box<dyn DevProcess>>>(
fn mobile_dev<R: Fn(MobileOptions) -> crate::Result<Box<dyn DevProcess + Send>>>(
&mut self,
options: MobileOptions,
runner: R,

View File

@ -197,7 +197,7 @@ impl Interface for Rust {
}
}
fn mobile_dev<R: Fn(MobileOptions) -> crate::Result<Box<dyn DevProcess>>>(
fn mobile_dev<R: Fn(MobileOptions) -> crate::Result<Box<dyn DevProcess + Send>>>(
&mut self,
mut options: MobileOptions,
runner: R,
@ -431,7 +431,7 @@ impl Rust {
options: Options,
run_args: Vec<String>,
on_exit: F,
) -> crate::Result<Box<dyn DevProcess>> {
) -> crate::Result<Box<dyn DevProcess + Send>> {
desktop::run_dev(
options,
run_args,
@ -441,10 +441,10 @@ impl Rust {
self.product_name.clone(),
on_exit,
)
.map(|c| Box::new(c) as Box<dyn DevProcess>)
.map(|c| Box::new(c) as Box<dyn DevProcess + Send>)
}
fn run_dev_watcher<F: Fn(&mut Rust) -> crate::Result<Box<dyn DevProcess>>>(
fn run_dev_watcher<F: Fn(&mut Rust) -> crate::Result<Box<dyn DevProcess + Send>>>(
&mut self,
config: Option<String>,
run: Arc<F>,

View File

@ -225,6 +225,7 @@ mod tests {
.as_array()
.expect("features must be an array")
.clone();
if toml.contains("reqwest-native-tls-vendored") {
assert!(
features
@ -233,10 +234,22 @@ mod tests {
"reqwest-native-tls-vendored was not replaced with native-tls-vendored"
);
}
if toml.contains("system-tray") {
assert!(
features
.iter()
.any(|f| f.as_str().expect("feature must be a string") == "tray-icon"),
"system-tray was not replaced with tray-icon"
);
}
for feature in features.iter() {
let feature = feature.as_str().expect("feature must be a string");
assert!(
keep_features.contains(&feature) || feature == "native-tls-vendored",
keep_features.contains(&feature)
|| feature == "native-tls-vendored"
|| feature == "tray-icon",
"feature {feature} should have been removed"
);
}

View File

@ -235,7 +235,7 @@ fn run_dev(
crate::dev::wait_dev_process(c.clone(), move |status, reason| {
crate::dev::on_app_exit(status, reason, exit_on_panic, no_watch)
});
Ok(Box::new(c) as Box<dyn DevProcess>)
Ok(Box::new(c) as Box<dyn DevProcess + Send>)
}
Err(e) => {
crate::dev::kill_before_dev_process();

View File

@ -221,7 +221,7 @@ fn run_dev(
crate::dev::wait_dev_process(c.clone(), move |status, reason| {
crate::dev::on_app_exit(status, reason, exit_on_panic, no_watch)
});
Ok(Box::new(c) as Box<dyn DevProcess>)
Ok(Box::new(c) as Box<dyn DevProcess + Send>)
}
Err(e) => {
crate::dev::kill_before_dev_process();