rusty-fork icon indicating copy to clipboard operation
rusty-fork copied to clipboard

Question: how to handle custom environment variables and captured output?

Open volks73 opened this issue 3 years ago • 0 comments

I am experimenting with your crate for testing my cargo-wix subcommand. This would be for Windows and it most revolves around modifying the Current Working Directory (CWD) for each of the tests. I have been testing with --test-threads=1, which forces all tests to execute serially. I added any integration tests that modify the CWD to the rusty_fork_test! macro, and it all appeared to work great! I can now run the tests without forcing serial execution. Thank you!

However, I have implemented a series of CARGO_WIX_TEST_<NAME> environment variables to toggle various outputs and functionality when running tests. These no longer appear to be working with the tests. Please see the Tests section of the README for information about the various environment variables.

I cannot tell if these environment variables are being passed to each of the tests or if it is something related to capturing output/redirecting STDOUT and STDERR with the "forked" child processes. I tried answering this myself by looking through the macro implementation, but I quickly became lost. I am hoping you could provide some direction and/or information.

volks73 avatar Nov 21 '20 22:11 volks73