summaryrefslogtreecommitdiff
path: root/tests/specs/mod.rs
diff options
context:
space:
mode:
authorhaturau <135221985+haturatu@users.noreply.github.com>2024-11-20 01:20:47 +0900
committerGitHub <noreply@github.com>2024-11-20 01:20:47 +0900
commit85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch)
treeface0aecaac53e93ce2f23b53c48859bcf1a36ec /tests/specs/mod.rs
parent67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff)
parent186b52731c6bb326c4d32905c5e732d082e83465 (diff)
Merge branch 'denoland:main' into main
Diffstat (limited to 'tests/specs/mod.rs')
-rw-r--r--tests/specs/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/specs/mod.rs b/tests/specs/mod.rs
index 34221dd9d..b4c8781d3 100644
--- a/tests/specs/mod.rs
+++ b/tests/specs/mod.rs
@@ -119,6 +119,9 @@ struct MultiStepMetaData {
/// steps.
#[serde(default)]
pub temp_dir: bool,
+ /// Whether the temporary directory should be symlinked to another path.
+ #[serde(default)]
+ pub symlinked_temp_dir: bool,
/// The base environment to use for the test.
#[serde(default)]
pub base: Option<String>,
@@ -142,6 +145,8 @@ struct SingleTestMetaData {
#[serde(default)]
pub temp_dir: bool,
#[serde(default)]
+ pub symlinked_temp_dir: bool,
+ #[serde(default)]
pub repeat: Option<usize>,
#[serde(flatten)]
pub step: StepMetaData,
@@ -155,6 +160,7 @@ impl SingleTestMetaData {
base: self.base,
cwd: None,
temp_dir: self.temp_dir,
+ symlinked_temp_dir: self.symlinked_temp_dir,
repeat: self.repeat,
envs: Default::default(),
steps: vec![self.step],
@@ -330,6 +336,20 @@ fn test_context_from_metadata(
builder = builder.cwd(cwd.to_string_lossy());
}
+ if metadata.symlinked_temp_dir {
+ // not actually deprecated, we just want to discourage its use
+ // because it's mostly used for testing purposes locally
+ #[allow(deprecated)]
+ {
+ builder = builder.use_symlinked_temp_dir();
+ }
+ if cfg!(not(debug_assertions)) {
+ // panic to prevent using this on the CI as CI already uses
+ // a symlinked temp directory for every test
+ panic!("Cannot use symlinkedTempDir in release mode");
+ }
+ }
+
match &metadata.base {
// todo(dsherret): add bases in the future as needed
Some(base) => panic!("Unknown test base: {}", base),