diff options
Diffstat (limited to 'test_util/src/builders.rs')
-rw-r--r-- | test_util/src/builders.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test_util/src/builders.rs b/test_util/src/builders.rs index a000e5bcd..049ccbd67 100644 --- a/test_util/src/builders.rs +++ b/test_util/src/builders.rs @@ -31,6 +31,7 @@ pub struct TestContextBuilder { use_http_server: bool, use_temp_cwd: bool, use_separate_deno_dir: bool, + use_symlinked_temp_dir: bool, /// Copies the files at the specified directory in the "testdata" directory /// to the temp folder and runs the test from there. This is useful when /// the test creates files in the testdata directory (ex. a node_modules folder) @@ -59,6 +60,18 @@ impl TestContextBuilder { self } + /// Causes the temp directory to be symlinked to a target directory + /// which is useful for debugging issues that only show up on the CI. + /// + /// Note: This method is not actually deprecated, it's just the CI + /// does this by default so there's no need to check in any code that + /// uses this into the repo. This is just for debugging purposes. + #[deprecated] + pub fn use_symlinked_temp_dir(mut self) -> Self { + self.use_symlinked_temp_dir = true; + self + } + /// By default, the temp_dir and the deno_dir will be shared. /// In some cases, that might cause an issue though, so calling /// this will use a separate directory for the deno dir and the @@ -110,6 +123,11 @@ impl TestContextBuilder { } else { deno_dir.clone() }; + let temp_dir = if self.use_symlinked_temp_dir { + TempDir::new_symlinked(temp_dir) + } else { + temp_dir + }; let testdata_dir = if let Some(temp_copy_dir) = &self.copy_temp_dir { let test_data_path = testdata_path().join(temp_copy_dir); let temp_copy_dir = temp_dir.path().join(temp_copy_dir); |