diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-08-10 17:41:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-10 17:41:19 +0200 |
commit | 6fcf06306ed2ea52031a97b918f1e929d7209250 (patch) | |
tree | 01eaea1836d5ee864aafb57677c9fb4d76e33eba /cli/doc/tests.rs | |
parent | fdb2dab7cd59a70b79704e0a0efca44be2bfc186 (diff) |
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.
Diffstat (limited to 'cli/doc/tests.rs')
-rw-r--r-- | cli/doc/tests.rs | 21 |
1 files changed, 19 insertions, 2 deletions
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", } } ]); |