@@ -32,7 +32,7 @@ type DocNodeWithJsDoc<T = DocNodeBase> = T & {
32
32
33
33
const TS_SNIPPET = / ` ` ` t s [ \s \S ] * ?` ` ` / g;
34
34
const ASSERTION_IMPORT =
35
- / f r o m " @ s t d \/ ( a s s e r t ( \/ [ a - z - ] + ) ? | t e s t i n g \/ ( m o c k | s n a p s h o t | t y p e s ) ) " / g;
35
+ / f r o m " @ s t d \/ ( a s s e r t ( \/ [ a - z - ] + ) ? | e x p e c t ( \/ [ a - z - ] + ) ? | t e s t i n g \/ ( m o c k | s n a p s h o t | t y p e s ) ) " / g;
36
36
const NEWLINE = "\n" ;
37
37
const diagnostics : DocumentError [ ] = [ ] ;
38
38
@@ -156,7 +156,7 @@ function assertHasSnippets(
156
156
if ( ! ( delim ?. includes ( "no-assert" ) || delim ?. includes ( "ignore" ) ) ) {
157
157
assert (
158
158
snippet . match ( ASSERTION_IMPORT ) !== null ,
159
- "Snippet must contain assertion from ' @std/assert' " ,
159
+ "Snippet must contain assertion from ` @std/assert`, `@std/expect` or `@std/testing` " ,
160
160
document ,
161
161
) ;
162
162
}
@@ -170,6 +170,7 @@ function assertHasExampleTag(
170
170
tag . kind === "example"
171
171
) as JsDocTagDocRequired [ ] ;
172
172
assert ( exampleTags ?. length > 0 , "Symbol must have an @example tag" , document ) ;
173
+ if ( exampleTags === undefined ) return ;
173
174
for ( const tag of exampleTags ) {
174
175
assert (
175
176
tag . doc !== undefined ,
@@ -415,15 +416,15 @@ async function assertDocs(specifiers: string[]) {
415
416
}
416
417
}
417
418
418
- async function checkDocs ( specifiers : string [ ] ) {
419
- const lintStatus = await new Deno . Command ( Deno . execPath ( ) , {
419
+ export async function checkDocs ( specifiers : string [ ] ) {
420
+ const { success , stderr } = await new Deno . Command ( Deno . execPath ( ) , {
420
421
args : [ "doc" , "--lint" , ...specifiers ] ,
421
422
stdin : "inherit" ,
422
423
stdout : "inherit" ,
423
- stderr : "inherit " ,
424
+ stderr : "piped " ,
424
425
} ) . output ( ) ;
425
- if ( ! lintStatus . success ) {
426
- throw new Error ( new TextDecoder ( ) . decode ( lintStatus . stderr ) ) ;
426
+ if ( ! success ) {
427
+ throw new Error ( new TextDecoder ( ) . decode ( stderr ) ) ;
427
428
}
428
429
429
430
await assertDocs ( specifiers ) ;
0 commit comments