Does crate-type has effect on integration test?

I found that if I marked my crate as

name = "my_crate"
crate-type = ["staticlib", "cdylib"]

Then the integration test cannot find crate or module "my_crate": failed to resolve: use of undeclared crate or module my_crate.

Is this by design? And how can I make my test work without comment the line crate-type = ["staticlib", "cdylib"] when testing?

You can add rlib to the list of crate types if you want rust crates (like your integration tests) to be able to depend on my_crate.

1 Like

As for why it's necessary - integration tests are compiled treating the create itself as if it was an extern crate, like an ordinary Cargo dependency. To be used in this way, crate have to be compiled as rlib.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.