summaryrefslogtreecommitdiff
path: root/tests/testdata/doc
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-02-10 13:22:13 -0700
committerGitHub <noreply@github.com>2024-02-10 20:22:13 +0000
commitf5e46c9bf2f50d66a953fa133161fc829cecff06 (patch)
tree8faf2f5831c1c7b11d842cd9908d141082c869a5 /tests/testdata/doc
parentd2477f780630a812bfd65e3987b70c0d309385bb (diff)
chore: move cli/tests/ -> tests/ (#22369)
This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit.
Diffstat (limited to 'tests/testdata/doc')
-rw-r--r--tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts6
-rw-r--r--tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out9
-rw-r--r--tests/testdata/doc/deno_doc.ts3
-rw-r--r--tests/testdata/doc/deno_doc2.ts3
-rw-r--r--tests/testdata/doc/deno_doc_builtin.out3
-rw-r--r--tests/testdata/doc/import_map.json5
-rw-r--r--tests/testdata/doc/invalid_url.out4
-rw-r--r--tests/testdata/doc/lint_success.out1
-rw-r--r--tests/testdata/doc/lint_success.ts5
-rw-r--r--tests/testdata/doc/lint_success_html.out1
-rw-r--r--tests/testdata/doc/lint_success_json.out50
-rw-r--r--tests/testdata/doc/module/fun.js2
-rw-r--r--tests/testdata/doc/referenced_private_types.out12
-rw-r--r--tests/testdata/doc/referenced_private_types.ts7
-rw-r--r--tests/testdata/doc/referenced_private_types_fixed.out1
-rw-r--r--tests/testdata/doc/referenced_private_types_fixed.ts11
-rw-r--r--tests/testdata/doc/referenced_private_types_lint.out28
-rw-r--r--tests/testdata/doc/types_header.out6
-rw-r--r--tests/testdata/doc/types_header.ts1
-rw-r--r--tests/testdata/doc/types_hint.out5
-rw-r--r--tests/testdata/doc/types_hint.ts2
-rw-r--r--tests/testdata/doc/types_ref.js2
-rw-r--r--tests/testdata/doc/types_ref.out5
-rw-r--r--tests/testdata/doc/use_import_map.js1
-rw-r--r--tests/testdata/doc/use_import_map.out5
25 files changed, 178 insertions, 0 deletions
diff --git a/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts b/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts
new file mode 100644
index 000000000..854c1b464
--- /dev/null
+++ b/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts
@@ -0,0 +1,6 @@
+// deno-lint-ignore-file
+export namespace NS {
+ export function test(name: string, fn: Function): void;
+ export function test(options: object): void;
+ export function test(name: string | object, fn?: Function): void {}
+}
diff --git a/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out b/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out
new file mode 100644
index 000000000..28d1cb921
--- /dev/null
+++ b/tests/testdata/doc/060_deno_doc_displays_all_overloads_in_details_view.ts.out
@@ -0,0 +1,9 @@
+Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:3:3
+
+function test(name: string, fn: Function): void
+
+Defined in [WILDCARD]/060_deno_doc_displays_all_overloads_in_details_view.ts:4:3
+
+function test(options: object): void
+
+
diff --git a/tests/testdata/doc/deno_doc.ts b/tests/testdata/doc/deno_doc.ts
new file mode 100644
index 000000000..fb3c50957
--- /dev/null
+++ b/tests/testdata/doc/deno_doc.ts
@@ -0,0 +1,3 @@
+/** Some JSDoc */
+export function foo() {
+}
diff --git a/tests/testdata/doc/deno_doc2.ts b/tests/testdata/doc/deno_doc2.ts
new file mode 100644
index 000000000..ee6fc22dc
--- /dev/null
+++ b/tests/testdata/doc/deno_doc2.ts
@@ -0,0 +1,3 @@
+/** Some JSDoc */
+export function bar() {
+}
diff --git a/tests/testdata/doc/deno_doc_builtin.out b/tests/testdata/doc/deno_doc_builtin.out
new file mode 100644
index 000000000..b4a90d6bc
--- /dev/null
+++ b/tests/testdata/doc/deno_doc_builtin.out
@@ -0,0 +1,3 @@
+[WILDCARD]
+namespace Deno
+[WILDCARD] \ No newline at end of file
diff --git a/tests/testdata/doc/import_map.json b/tests/testdata/doc/import_map.json
new file mode 100644
index 000000000..244a30296
--- /dev/null
+++ b/tests/testdata/doc/import_map.json
@@ -0,0 +1,5 @@
+{
+ "imports": {
+ "rex/": "./module/"
+ }
+}
diff --git a/tests/testdata/doc/invalid_url.out b/tests/testdata/doc/invalid_url.out
new file mode 100644
index 000000000..038c53177
--- /dev/null
+++ b/tests/testdata/doc/invalid_url.out
@@ -0,0 +1,4 @@
+error: Invalid URL 'https://raw.githubusercontent.com%2Fdyedgreen%2Fdeno-sqlite%2Frework_api%2Fmod.ts'
+
+Caused by:
+ invalid domain character
diff --git a/tests/testdata/doc/lint_success.out b/tests/testdata/doc/lint_success.out
new file mode 100644
index 000000000..c05ac45a1
--- /dev/null
+++ b/tests/testdata/doc/lint_success.out
@@ -0,0 +1 @@
+Checked 1 file
diff --git a/tests/testdata/doc/lint_success.ts b/tests/testdata/doc/lint_success.ts
new file mode 100644
index 000000000..42c44b2d7
--- /dev/null
+++ b/tests/testdata/doc/lint_success.ts
@@ -0,0 +1,5 @@
+/** My test class. */
+export class Test {
+ /** My property. */
+ prop: string;
+}
diff --git a/tests/testdata/doc/lint_success_html.out b/tests/testdata/doc/lint_success_html.out
new file mode 100644
index 000000000..9503a335f
--- /dev/null
+++ b/tests/testdata/doc/lint_success_html.out
@@ -0,0 +1 @@
+Written 9 files to "./docs/"
diff --git a/tests/testdata/doc/lint_success_json.out b/tests/testdata/doc/lint_success_json.out
new file mode 100644
index 000000000..050b2540c
--- /dev/null
+++ b/tests/testdata/doc/lint_success_json.out
@@ -0,0 +1,50 @@
+[
+ {
+ "kind": "class",
+ "name": "Test",
+ "location": {
+ "filename": "file:///[WILDCARD]/lint_success.ts",
+ "line": 2,
+ "col": 0,
+ "byteIndex": 22
+ },
+ "declarationKind": "export",
+ "jsDoc": {
+ "doc": "My test class."
+ },
+ "classDef": {
+ "isAbstract": false,
+ "constructors": [],
+ "properties": [
+ {
+ "jsDoc": {
+ "doc": "My property."
+ },
+ "tsType": {
+ "repr": "string",
+ "kind": "keyword",
+ "keyword": "string"
+ },
+ "readonly": false,
+ "accessibility": null,
+ "optional": false,
+ "isAbstract": false,
+ "isStatic": false,
+ "name": "prop",
+ "location": {
+ "filename": "file:///[WILDCARD]/lint_success.ts",
+ "line": 4,
+ "col": 2,
+ "byteIndex": 66
+ }
+ }
+ ],
+ "indexSignatures": [],
+ "methods": [],
+ "extends": null,
+ "implements": [],
+ "typeParams": [],
+ "superTypeParams": []
+ }
+ }
+]
diff --git a/tests/testdata/doc/module/fun.js b/tests/testdata/doc/module/fun.js
new file mode 100644
index 000000000..28901d945
--- /dev/null
+++ b/tests/testdata/doc/module/fun.js
@@ -0,0 +1,2 @@
+/** This is some documentation */
+export function fun(_a, _b) {}
diff --git a/tests/testdata/doc/referenced_private_types.out b/tests/testdata/doc/referenced_private_types.out
new file mode 100644
index 000000000..3c91dbe15
--- /dev/null
+++ b/tests/testdata/doc/referenced_private_types.out
@@ -0,0 +1,12 @@
+Defined in file:///[WILDCARD]/doc/referenced_private_types.ts:5:1
+
+class MyClass
+
+ prop: MyInterface
+
+Defined in file:///[WILDCARD]/doc/referenced_private_types.ts:1:1
+
+private interface MyInterface
+
+ prop?: string
+
diff --git a/tests/testdata/doc/referenced_private_types.ts b/tests/testdata/doc/referenced_private_types.ts
new file mode 100644
index 000000000..9570d4625
--- /dev/null
+++ b/tests/testdata/doc/referenced_private_types.ts
@@ -0,0 +1,7 @@
+interface MyInterface {
+ prop?: string;
+}
+
+export class MyClass {
+ prop: MyInterface = {};
+}
diff --git a/tests/testdata/doc/referenced_private_types_fixed.out b/tests/testdata/doc/referenced_private_types_fixed.out
new file mode 100644
index 000000000..c05ac45a1
--- /dev/null
+++ b/tests/testdata/doc/referenced_private_types_fixed.out
@@ -0,0 +1 @@
+Checked 1 file
diff --git a/tests/testdata/doc/referenced_private_types_fixed.ts b/tests/testdata/doc/referenced_private_types_fixed.ts
new file mode 100644
index 000000000..cd99bc76e
--- /dev/null
+++ b/tests/testdata/doc/referenced_private_types_fixed.ts
@@ -0,0 +1,11 @@
+/** Doc comment */
+export interface MyInterface {
+ /** Doc comment */
+ prop?: string;
+}
+
+/** Doc comment */
+export class MyClass {
+ /** Doc comment */
+ prop: MyInterface = {};
+}
diff --git a/tests/testdata/doc/referenced_private_types_lint.out b/tests/testdata/doc/referenced_private_types_lint.out
new file mode 100644
index 000000000..328435cd7
--- /dev/null
+++ b/tests/testdata/doc/referenced_private_types_lint.out
@@ -0,0 +1,28 @@
+error[missing-jsdoc]: exported symbol is missing JSDoc documentation
+ --> [WILDCARD]:5:1
+ |
+5 | export class MyClass {
+ | ^
+
+
+error[private-type-ref]: public type 'MyClass.prototype.prop' references private type 'MyInterface'
+ --> [WILDCARD]:6:3
+ |
+6 | prop: MyInterface = {};
+ | ^
+ = hint: make the referenced type public or remove the reference
+ |
+1 | interface MyInterface {
+ | - this is the referenced type
+
+ info: to ensure documentation is complete all types that are exposed in the public API must be public
+
+
+error[missing-jsdoc]: exported symbol is missing JSDoc documentation
+ --> [WILDCARD]:6:3
+ |
+6 | prop: MyInterface = {};
+ | ^
+
+
+error: Found 3 documentation lint errors.
diff --git a/tests/testdata/doc/types_header.out b/tests/testdata/doc/types_header.out
new file mode 100644
index 000000000..a97b35dd7
--- /dev/null
+++ b/tests/testdata/doc/types_header.out
@@ -0,0 +1,6 @@
+Download http://127.0.0.1:4545/xTypeScriptTypes.js
+Download http://127.0.0.1:4545/xTypeScriptTypes.d.ts
+Defined in http://127.0.0.1:4545/xTypeScriptTypes.d.ts:1:14
+
+const foo: "foo"
+
diff --git a/tests/testdata/doc/types_header.ts b/tests/testdata/doc/types_header.ts
new file mode 100644
index 000000000..b64c8d000
--- /dev/null
+++ b/tests/testdata/doc/types_header.ts
@@ -0,0 +1 @@
+export * from "http://127.0.0.1:4545/xTypeScriptTypes.js";
diff --git a/tests/testdata/doc/types_hint.out b/tests/testdata/doc/types_hint.out
new file mode 100644
index 000000000..bfd5191a1
--- /dev/null
+++ b/tests/testdata/doc/types_hint.out
@@ -0,0 +1,5 @@
+Defined in [WILDCARD]/type_definitions/foo.d.ts:2:14
+
+const foo: string
+ An exported value.
+
diff --git a/tests/testdata/doc/types_hint.ts b/tests/testdata/doc/types_hint.ts
new file mode 100644
index 000000000..bacea46db
--- /dev/null
+++ b/tests/testdata/doc/types_hint.ts
@@ -0,0 +1,2 @@
+// @deno-types="../type_definitions/foo.d.ts"
+export * from "../type_definitions/foo.js";
diff --git a/tests/testdata/doc/types_ref.js b/tests/testdata/doc/types_ref.js
new file mode 100644
index 000000000..03d8b5570
--- /dev/null
+++ b/tests/testdata/doc/types_ref.js
@@ -0,0 +1,2 @@
+/// <reference types="../type_definitions/foo.d.ts" />
+export const foo = "foo";
diff --git a/tests/testdata/doc/types_ref.out b/tests/testdata/doc/types_ref.out
new file mode 100644
index 000000000..bfd5191a1
--- /dev/null
+++ b/tests/testdata/doc/types_ref.out
@@ -0,0 +1,5 @@
+Defined in [WILDCARD]/type_definitions/foo.d.ts:2:14
+
+const foo: string
+ An exported value.
+
diff --git a/tests/testdata/doc/use_import_map.js b/tests/testdata/doc/use_import_map.js
new file mode 100644
index 000000000..672a7a7bd
--- /dev/null
+++ b/tests/testdata/doc/use_import_map.js
@@ -0,0 +1 @@
+export { fun } from "rex/fun.js";
diff --git a/tests/testdata/doc/use_import_map.out b/tests/testdata/doc/use_import_map.out
new file mode 100644
index 000000000..9509d5bfe
--- /dev/null
+++ b/tests/testdata/doc/use_import_map.out
@@ -0,0 +1,5 @@
+Defined in [WILDCARD]/doc/module/fun.js:2:1
+
+function fun(_a, _b): void
+ This is some documentation
+