3

I use some https://github.com/launchbadge/sqlx query! macros in my tests, and I need to be able to run cargo sqlx prepare for them so my IDE can expand the macros and provide type information (autocomplete, etc.).

But if I just run cargo sqlx prepare, all code behind #[cfg(test)] is ignored.

How can I tell cargo/sqlx to analyse my tests too?

HectorJ
  • 5,814
  • 3
  • 34
  • 52

1 Answers1

5

cargo sqlx prepare -- --tests does the trick

(--tests is passed to cargo rustc, which makes it build all tests)

HectorJ
  • 5,814
  • 3
  • 34
  • 52