summaryrefslogtreecommitdiff
path: root/cli/tests/integration/doc_tests.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-11-01 16:25:05 +0100
committerGitHub <noreply@github.com>2023-11-01 15:25:05 +0000
commit8ea2d926a9c75b0b13e7ad37e7181657d680560e (patch)
tree6a96beb4d9a877bf774dadb9f94cbf31134fe1fc /cli/tests/integration/doc_tests.rs
parentf8f4e776325efe0d8dd50207beecb425f0875999 (diff)
feat: deno doc --html (#21015)
This commit adds static documentation site generate to "deno doc" subcommand. Example: ``` $ deno doc --html --name="My library" ./mod.ts # outputs to ./docs/ $ deno doc --html --name="My library" --output=./documentation/ ./mod.ts ./file2.js # outputs to ./documentation/ $ deno doc --html --name="My library" ./**/mod.ts # generate docs for all files with "mod.ts" name ``` Closes https://github.com/denoland/deno/issues/8233
Diffstat (limited to 'cli/tests/integration/doc_tests.rs')
-rw-r--r--cli/tests/integration/doc_tests.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/cli/tests/integration/doc_tests.rs b/cli/tests/integration/doc_tests.rs
index a16f99dd9..f5ac44a02 100644
--- a/cli/tests/integration/doc_tests.rs
+++ b/cli/tests/integration/doc_tests.rs
@@ -64,6 +64,12 @@ itest!(deno_doc_lint_referenced_private_types_fixed {
output: "doc/referenced_private_types_fixed.out",
});
+itest!(deno_doc_html_lint_referenced_private_types_fixed {
+ args: "doc --lint --html --name=Library doc/referenced_private_types.ts",
+ exit_code: 1,
+ output: "doc/referenced_private_types_lint.out",
+});
+
itest!(_060_deno_doc_displays_all_overloads_in_details_view {
args:
"doc --filter NS.test doc/060_deno_doc_displays_all_overloads_in_details_view.ts",
@@ -96,3 +102,32 @@ itest!(doc_no_lock {
cwd: Some("lockfile/basic"),
output: "lockfile/basic/doc.nolock.out",
});
+
+#[test]
+fn deno_doc_html() {
+ let context = TestContext::default();
+ let temp_dir = context.temp_dir();
+ let output = context
+ .new_command()
+ .env("NO_COLOR", "1")
+ .args_vec(vec![
+ "doc",
+ "--html",
+ "--name=MyLib",
+ &format!("--output={}", temp_dir.path().to_string_lossy()),
+ "doc/referenced_private_types_fixed.ts",
+ ])
+ .split_output()
+ .run();
+
+ output.assert_exit_code(0);
+ assert_contains!(output.stderr(), "Written 8 files to");
+ assert!(temp_dir.path().join("index.html").exists());
+ assert!(temp_dir.path().join("compound_index.html").exists());
+ assert!(temp_dir.path().join("fuse.js").exists());
+ assert!(temp_dir.path().join("search.js").exists());
+ assert!(temp_dir.path().join("search_index.js").exists());
+ assert!(temp_dir.path().join("styles.css").exists());
+ assert!(temp_dir.path().join("MyInterface.html").exists());
+ assert!(temp_dir.path().join("MyClass.html").exists());
+}