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