Skip to content

Conversation

@michaeltlombardi
Copy link
Collaborator

PR Summary

This change:

  1. Adds the doctest setting to the crate manifests as false to disable documentation tests by default. These tests can still be invoked by passing the --doc flag to cargo test.
  2. Updates the build helpers module to enable separately generating documentation for Rust crates and testing the examples in that documentation.
  3. Adds a new workflow job for generating and testing documentation separately from the rest of the build and test scripts. While these jobs failing won't prevent the continued unit/integration/acceptance tests, it will still fail the build.

This change should help ensure that any examples in our documentation remain valid. It doesn't test to ensure that public APIs are documented, only that the documentation that exists is minimally valid.

PR Context

Prior to this change, invoking cargo test for library crates without specifically choosing a test subset (unit, integration, etc) would always run the documentation tests.

Documentation tests are particularly slow because Rust compiles a binary for every codeblock in your documentation. This is the slowest part of the rust tests when working on a library with extensive examples.

Prior to this change, invoking `cargo test` for library crates without
specifically choosing a test subset (unit, integration, etc) would
always run the documentation tests.

Documentation tests are particularly slow because Rust compiles a binary
for every codeblock in your documentation. This is the slowest part of
the rust tests when working on a library with extensive examples.

This change adds the `doctest` setting to the crate manifests as `false`
to disable documentation tests by default. These tests can still be
invoked by passing the `--doc` flag to `cargo test`.

Future changes will provide simplified access to generating and testing
the docs from the build script, as well as validating documentation in
CI.
@michaeltlombardi michaeltlombardi marked this pull request as draft October 22, 2025 22:38
This change updates the build helpers module to enable separately
generating documentation for Rust crates and testing the examples in
that documentation.

It also adds a new workflow job for generating and testing documentation
separately from the rest of the build and test scripts. While these jobs
failing won't prevent the continued unit/integration/acceptance tests,
it will still fail the build.

This should help ensure that any examples in our documentation remain
valid. It _doesn't_ test to ensure that public APIs are documented, only
that the documentation that exists is minimally valid.
@michaeltlombardi michaeltlombardi force-pushed the maint/main/separate-testing branch from 1681eb4 to 1fa3d71 Compare October 22, 2025 22:42
@michaeltlombardi michaeltlombardi marked this pull request as ready for review October 22, 2025 22:56
@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Oct 23, 2025
Merged via the queue into PowerShell:main with commit 1f6adbb Oct 23, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants