Is there a way to skip doctests when running cargo from the command line.
My project tests have got too slow for my git pre-commit hook. I can avoid running some of the longer running tests with --skip. But the doctests are actually the slowest part of test execution for me (not sure why, they are not very intense). I'd like to be able to not run them without removing them.
This command will run library unit tests (--lib), binary unit tests (--bins), and integration tests (--tests), but not doctests:
cargo test --lib --bins --tests
You can omit arguments that don't apply to your project. For example, if your only tests are part of your library crate, you can just run cargo test --lib.
Every doctest is compiled into a separate binary, so doctests have a lot of compiler and linker overhead.