enable IR tests for plugins

This commit is contained in:
Devyn Cairns 2024-07-06 01:11:25 -07:00
parent 9498c06631
commit 5cbc591094
No known key found for this signature in database

View File

@ -382,24 +382,33 @@ where
if !executable_path.exists() { if !executable_path.exists() {
executable_path = crate::fs::installed_nu_path(); executable_path = crate::fs::installed_nu_path();
} }
let process = match setup_command(&executable_path, &target_cwd)
.envs(envs) let mut nu = setup_command(&executable_path, &target_cwd);
.arg("--commands")
.arg(command) nu.envs(envs);
nu.arg("--commands");
nu.arg(command);
// Use plain errors to help make error text matching more consistent // Use plain errors to help make error text matching more consistent
.args(["--error-style", "plain"]) nu.args(["--error-style", "plain"]);
.arg("--config") nu.arg("--config");
.arg(temp_config_file) nu.arg(temp_config_file);
.arg("--env-config") nu.arg("--env-config");
.arg(temp_env_config_file) nu.arg(temp_env_config_file);
.arg("--plugin-config") nu.arg("--plugin-config");
.arg(temp_plugin_file) nu.arg(temp_plugin_file);
.arg("--plugins") nu.arg("--plugins");
.arg(plugins_arg) nu.arg(plugins_arg);
.stdout(Stdio::piped())
.stderr(Stdio::piped()) // Test plugin tests with IR too, if asked to
.spawn() if std::env::var("NU_TEST_USE_IR").is_ok() {
{ nu.arg("--use-ir");
}
nu.stdout(Stdio::piped());
nu.stderr(Stdio::piped());
let process = match nu.spawn() {
Ok(child) => child, Ok(child) => child,
Err(why) => panic!("Can't run test {}", why), Err(why) => panic!("Can't run test {}", why),
}; };