Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(test): add support for type checking documentation #10521

Merged

Conversation

caspervonb
Copy link
Contributor

@caspervonb caspervonb commented May 6, 2021

This adds support for inline documentation tests.

Blocks of code within a jsdoc/tsdoc style block comment that are encased in fenced code blocks get parsed out to individual modules, type checked (and will later be run as test programs but we cut for now that to hit the release deadline).

Example:

/**
 * ```ts
 * import { example } from "./example.ts";
 *
 * example();
 * ```
 */
export function example() {
  // ...
}

@buttercubz buttercubz mentioned this pull request May 9, 2021
@caspervonb
Copy link
Contributor Author

Cut out running for now to hit the 1.10 window, will land running documentation examples in a follow up after today's release.

@caspervonb caspervonb marked this pull request as ready for review May 10, 2021 23:26
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is great for a first pass, we'll iterate on it after 1.10. Huge thanks Casper for picking up this PR!

@bartlomieju bartlomieju changed the title feat(cli): add support for testing documentation feat(test): add support for type checking documentation May 10, 2021
@bartlomieju bartlomieju merged commit 36c5461 into denoland:main May 10, 2021
@caspervonb caspervonb deleted the feat-add-support-for-documentation-tests branch May 11, 2021 02:04
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