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 = 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            );
23            if !res.status.success() {
24                self.fatal_proc_rec("rustdoc-js test failed!", &res);
25            }
26        } else {
27            self.fatal("no nodeJS");
28        }
29    }
30}