compiletest/runtest/js_doc.rs
1use std::process::Command;
2
3use super::{DocKind, TestCx};
4
5impl TestCx<'_> {
6 pub(super) fn run_rustdoc_js_test(&self) {
7 if let Some(nodejs) = &self.config.nodejs {
8 let out_dir = self.output_base_dir();
9
10 self.document(&out_dir, DocKind::Html);
11
12 let file_stem = self.testpaths.file.file_stem().expect("no file stem");
13 let res = self.run_command_to_procres(
14 Command::new(&nodejs)
15 .arg(self.config.src_root.join("src/tools/rustdoc-js/tester.js"))
16 .arg("--doc-folder")
17 .arg(out_dir)
18 .arg("--crate-name")
19 .arg(file_stem.replace("-", "_"))
20 .arg("--test-file")
21 .arg(self.testpaths.file.with_extension("js"))
22 .arg("--revision")
23 .arg(self.revision.unwrap_or_default()),
24 );
25 if !res.status.success() {
26 self.fatal_proc_rec("rustdoc-js test failed!", &res);
27 }
28 } else {
29 self.fatal("no nodeJS");
30 }
31 }
32}