dtolnay/cargo-expand

Expanding integration tests

bicarlsen opened this issue · 5 comments

When running cargo expand --lib --tests integration tests (located in the tests folder) are not epanded. I have confirmed the the same tests as unit tests (located in src/lib.rs) are expanded properly.

Is there a way to include the integration tests in the expansion?

ehuss commented

cargo expand can only expand one target at a time. You have to pass the name of the integration test as in cargo expand --test foo.

That results in the error no test target named '<test_name>'.

Do I have to qualify the test in some way? e.g. cargo expand --test my_integration_tests::test_name?

I also tried specifiying the test target in my Cargo.toml as described in Issue #40 (here) but it did not resolve the issue.

Sounds like you're putting the name of the function, not the name of the integration test target.

It's cargo expand --test my_integration_tests.

Ah, yes that was the issue. Thank you for the clarification.