From 5cbc591094e5106f8335b3b9e8d85ef0d89501d8 Mon Sep 17 00:00:00 2001 From: Devyn Cairns Date: Sat, 6 Jul 2024 01:11:25 -0700 Subject: [PATCH] enable IR tests for plugins --- crates/nu-test-support/src/macros.rs | 45 +++++++++++++++++----------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/crates/nu-test-support/src/macros.rs b/crates/nu-test-support/src/macros.rs index 25d7855111..9e5d9e2e7e 100644 --- a/crates/nu-test-support/src/macros.rs +++ b/crates/nu-test-support/src/macros.rs @@ -382,24 +382,33 @@ where if !executable_path.exists() { executable_path = crate::fs::installed_nu_path(); } - let process = match setup_command(&executable_path, &target_cwd) - .envs(envs) - .arg("--commands") - .arg(command) - // Use plain errors to help make error text matching more consistent - .args(["--error-style", "plain"]) - .arg("--config") - .arg(temp_config_file) - .arg("--env-config") - .arg(temp_env_config_file) - .arg("--plugin-config") - .arg(temp_plugin_file) - .arg("--plugins") - .arg(plugins_arg) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - { + + let mut nu = setup_command(&executable_path, &target_cwd); + + nu.envs(envs); + + nu.arg("--commands"); + nu.arg(command); + // Use plain errors to help make error text matching more consistent + nu.args(["--error-style", "plain"]); + nu.arg("--config"); + nu.arg(temp_config_file); + nu.arg("--env-config"); + nu.arg(temp_env_config_file); + nu.arg("--plugin-config"); + nu.arg(temp_plugin_file); + nu.arg("--plugins"); + nu.arg(plugins_arg); + + // Test plugin tests with IR too, if asked to + 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, Err(why) => panic!("Can't run test {}", why), };