Skip to content

Commit 7105f2e

Browse files
committed
improve rustdoc-gui-test to find local node_modules
Signed-off-by: ozkanonur <[email protected]>
1 parent 498553f commit 7105f2e

File tree

1 file changed

+10
-0
lines changed
  • src/tools/rustdoc-gui-test/src

1 file changed

+10
-0
lines changed

src/tools/rustdoc-gui-test/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse
143143
}
144144

145145
let mut command = Command::new(&config.nodejs);
146+
147+
if let Ok(current_dir) = env::current_dir() {
148+
let local_node_modules = current_dir.join("node_modules");
149+
if local_node_modules.exists() {
150+
// Link the local node_modules if exists.
151+
// This is useful when we run rustdoc-gui-test from outside of the source root.
152+
env::set_var("NODE_PATH", local_node_modules);
153+
}
154+
}
155+
146156
command
147157
.arg(config.rust_src.join("src/tools/rustdoc-gui/tester.js"))
148158
.arg("--jobs")

0 commit comments

Comments
 (0)