compiletest/runtest/
js_doc.rs

1use std::process::Command;
2
3use super::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, &self.testpaths);
11
12            let root = self.config.find_rust_src_root().unwrap();
13            let file_stem =
14                self.testpaths.file.file_stem().and_then(|f| f.to_str()).expect("no file stem");
15            let res = self.run_command_to_procres(
16                Command::new(&nodejs)
17                    .arg(root.join("src/tools/rustdoc-js/tester.js"))
18                    .arg("--doc-folder")
19                    .arg(out_dir)
20                    .arg("--crate-name")
21                    .arg(file_stem.replace("-", "_"))
22                    .arg("--test-file")
23                    .arg(self.testpaths.file.with_extension("js")),
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}