From 6fcf06306ed2ea52031a97b918f1e929d7209250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 10 Aug 2020 17:41:19 +0200 Subject: feat(doc): handle imports (#6987) This commit adds additional objects to JSON output of "deno doc" command to facilitate linking between types in different modules. --- cli/doc/tests.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'cli/doc/tests.rs') diff --git a/cli/doc/tests.rs b/cli/doc/tests.rs index e46fff621..94d087ea3 100644 --- a/cli/doc/tests.rs +++ b/cli/doc/tests.rs @@ -153,9 +153,12 @@ import { bar } from "./nested_reexport.ts"; * JSDoc for const */ export const foo = "foo"; + +export const fizz = "fizz"; "#; let test_source_code = r#" export { default, foo as fooConst } from "./reexport.ts"; +import { fizz as buzz } from "./reexport.ts"; /** JSDoc for function */ export function fooFn(a: number) { @@ -177,7 +180,7 @@ export function fooFn(a: number) { .parse_with_reexports("file:///test.ts") .await .unwrap(); - assert_eq!(entries.len(), 2); + assert_eq!(entries.len(), 3); let expected_json = json!([ { @@ -199,7 +202,7 @@ export function fooFn(a: number) { "name": "fooFn", "location": { "filename": "file:///test.ts", - "line": 5, + "line": 6, "col": 0 }, "jsDoc": "JSDoc for function", @@ -220,6 +223,20 @@ export function fooFn(a: number) { "returnType": null, "isAsync": false, "isGenerator": false + }, + }, + { + "kind": "import", + "name": "buzz", + "location": { + "filename": "file:///test.ts", + "line": 3, + "col": 0 + }, + "jsDoc": null, + "importDef": { + "src": "file:///reexport.ts", + "imported": "fizz", } } ]); -- cgit v1.2.3