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

deno test --doc: generated docs tests in JSDoc should it for naming (e.g. @example, token name, etc.) #25995

Open
lowlighter opened this issue Oct 2, 2024 · 0 comments
Labels
suggestion suggestions for new features (yet to be agreed) testing related to deno test and coverage

Comments

@lowlighter
Copy link
Contributor

Currently the @example JSdoc annotation can be used to title examples in generaed documentation.
(Example @std/fmt/bytes)

When using deno doc --test currently the name are auto-generated with the filename/lines, but for long files it makes it a bit cryptic to map them back easily.

A solution would be to use the @example value (if defined) to set the Deno.test name.
Eventually, the name of the token could be used too (e.g. the name of the documented function, variable, etc.)

vscode ➜ /workspaces/fmt/bytes $ deno test --allow-read --doc test.ts 
Check file:///workspaces/fmt/bytes/test.ts
Check file:///workspaces/fmt/bytes/test.ts$7-14.ts
Check file:///workspaces/fmt/bytes/test.ts$79-86.ts
Check file:///workspaces/fmt/bytes/test.ts$89-95.ts
Check file:///workspaces/fmt/bytes/test.ts$98-105.ts
Check file:///workspaces/fmt/bytes/test.ts$108-114.ts
running 0 tests from ./test.ts
running 1 test from ./test.ts$7-14.ts
file:///workspaces/fmt/bytes/test.ts$7-14.ts ... ok (0ms)
running 1 test from ./test.ts$79-86.ts
file:///workspaces/fmt/bytes/test.ts$79-86.ts format: Basic usage ... ok (0ms)
running 1 test from ./test.ts$89-95.ts
file:///workspaces/fmt/bytes/test.ts$89-95.ts format: Include bits representation ... ok (0ms)
running 1 test from ./test.ts$98-105.ts
file:///workspaces/fmt/bytes/test.ts$98-105.ts format: Include sign ... ok (0ms)
running 1 test from ./test.ts$108-114.ts
file:///workspaces/fmt/bytes/test.ts$108-114.ts format: Change locale ... ok (16ms)

Maybe also there may be no need to put the full file url, as the running X test from ./... is relative, it'd be less verbose to not be an absolute url/path but just a relative one

@lowlighter lowlighter changed the title deno doc --test: generated docs tests in JSDoc should use them to name them (e.g. @example, token name, etc.) deno test --doc: generated docs tests in JSDoc should use them to name them (e.g. @example, token name, etc.) Oct 2, 2024
@lowlighter lowlighter changed the title deno test --doc: generated docs tests in JSDoc should use them to name them (e.g. @example, token name, etc.) deno test --doc: generated docs tests in JSDoc should it for naming (e.g. @example, token name, etc.) Oct 2, 2024
@bartlomieju bartlomieju added suggestion suggestions for new features (yet to be agreed) testing related to deno test and coverage labels Oct 2, 2024
@lucacasonato lucacasonato added suggestion suggestions for new features (yet to be agreed) and removed suggestion suggestions for new features (yet to be agreed) labels Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion suggestions for new features (yet to be agreed) testing related to deno test and coverage
Projects
None yet
Development

No branches or pull requests

3 participants