Closed kungfucop closed 4 years ago
I took the liberty of editing the formatting of your post a bit, I hope you do not mind it was just a bit hard to read.
Unfortunately, this is the expected behavior due to the way #[cfg(test)]
works in Rust. When a different crate is pulled over, even if you are running tests, it will not build that dependent crate with the test cfg enabled for them, it will only enable the test cfg within the crate currently being tested.
For more info: https://stackoverflow.com/questions/41700543/can-we-share-test-utilites-between-crates.
Eventually I want to provide workarounds for this limitation, or at least specified suggestions within a small guide of how to make it work but it couldn't be through the #[cfg(test]
unfortunately.
Thank you @nrxus for the answer. Please keep the good work going, I search all github trying to find something could mock my db/network calls easily. Feel there is a lot potential in faux!
A guide on how to work around this for now will be super helpful!!