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