diff options
| author | ozkanonur <work@onurozkan.dev> | 2023-05-29 23:01:02 +0300 |
|---|---|---|
| committer | ozkanonur <work@onurozkan.dev> | 2023-05-29 23:01:02 +0300 |
| commit | 7105f2ea7397c86a70ffa73bf663001e3048c94c (patch) | |
| tree | 68c2098832b4b69a1f688ba8d7ddeaf4ab55a6b3 | |
| parent | 498553fc04f6a3fdc53412320f4e913bc53bc267 (diff) | |
| download | rust-7105f2ea7397c86a70ffa73bf663001e3048c94c.tar.gz rust-7105f2ea7397c86a70ffa73bf663001e3048c94c.zip | |
improve `rustdoc-gui-test` to find local `node_modules`
Signed-off-by: ozkanonur <work@onurozkan.dev>
| -rw-r--r-- | src/tools/rustdoc-gui-test/src/main.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/rustdoc-gui-test/src/main.rs b/src/tools/rustdoc-gui-test/src/main.rs index 8dc18dfaea2..af9b4e9d680 100644 --- a/src/tools/rustdoc-gui-test/src/main.rs +++ b/src/tools/rustdoc-gui-test/src/main.rs @@ -143,6 +143,16 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse } let mut command = Command::new(&config.nodejs); + + if let Ok(current_dir) = env::current_dir() { + let local_node_modules = current_dir.join("node_modules"); + if local_node_modules.exists() { + // Link the local node_modules if exists. + // This is useful when we run rustdoc-gui-test from outside of the source root. + env::set_var("NODE_PATH", local_node_modules); + } + } + command .arg(config.rust_src.join("src/tools/rustdoc-gui/tester.js")) .arg("--jobs") |
