■ ■ ■ ■ ■ ■ ■
rust/tests/end-to-end_test.rs
| skipped 12 lines |
13 | 13 | | |
14 | 14 | | use super::*; |
15 | 15 | | use assert_cmd::prelude::*; |
| 16 | + | use std::collections::HashMap; |
16 | 17 | | use std::process::Command; |
17 | 18 | | |
18 | 19 | | #[test] |
| skipped 15 lines |
34 | 35 | | Command::cargo_bin("cfonts").unwrap().args(&test.args).output().expect("failed to execute rust process"); |
35 | 36 | | let mut nodejs_args = test.args.clone(); |
36 | 37 | | nodejs_args.insert(0, "../nodejs/bin/index.js".to_string()); |
37 | | - | let nodejs_output = Command::new("node").args(nodejs_args).output().expect("failed to execute nodejs process"); |
| 38 | + | |
| 39 | + | let mut nodejs_env: HashMap<String, String> = HashMap::new(); |
| 40 | + | if !test.force_color.is_empty() { |
| 41 | + | nodejs_env.insert(String::from("FORCE_COLOR"), test.force_color.clone()); |
| 42 | + | } |
| 43 | + | if test.no_color { |
| 44 | + | nodejs_env.insert(String::from("NO_COLOR"), appendix.to_owned()); |
| 45 | + | } |
| 46 | + | let nodejs_output = |
| 47 | + | Command::new("node").envs(nodejs_env).args(nodejs_args).output().expect("failed to execute nodejs process"); |
38 | 48 | | |
39 | 49 | | assert_eq!( |
40 | 50 | | String::from_utf8_lossy(&rust_output.stdout).to_string() + appendix, |
| skipped 1902 lines |