Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaslyang authored and nicholaslyang committed Sep 18, 2023
1 parent ff546d6 commit c8ac30f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 20 deletions.
20 changes: 10 additions & 10 deletions crates/turborepo-lib/src/config/turbo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ mod tests {
; "global dot env (unsorted)")]
#[test_case(r#"{ "globalPassThroughEnv": ["GITHUB_TOKEN", "AWS_SECRET_KEY"] }"#,
TurboJson {
global_pass_through_env: vec!["AWS_SECRET_KEY".to_string(), "GITHUB_TOKEN".to_string()],
global_pass_through_env: Some(vec!["AWS_SECRET_KEY".to_string(), "GITHUB_TOKEN".to_string()]),
..TurboJson::default()
}
)]
Expand Down Expand Up @@ -614,9 +614,9 @@ mod tests {
"//#build".into(),
BookkeepingTaskDefinition {
defined_fields: ["Cache".to_string()].into_iter().collect(),
task_definition: TaskDefinitionHashable {
task_definition: TaskDefinitionStable {
cache: false,
..TaskDefinitionHashable::default()
..TaskDefinitionStable::default()
},
..BookkeepingTaskDefinition::default()
}
Expand Down Expand Up @@ -649,9 +649,9 @@ mod tests {
"//#build".into(),
BookkeepingTaskDefinition {
defined_fields: ["Cache".to_string()].into_iter().collect(),
task_definition: TaskDefinitionHashable {
task_definition: TaskDefinitionStable {
cache: true,
..TaskDefinitionHashable::default()
..TaskDefinitionStable::default()
},
..BookkeepingTaskDefinition::default()
}
Expand All @@ -660,9 +660,9 @@ mod tests {
"//#test".into(),
BookkeepingTaskDefinition {
defined_fields: ["Cache".to_string()].into_iter().collect(),
task_definition: TaskDefinitionHashable {
task_definition: TaskDefinitionStable {
cache: false,
..TaskDefinitionHashable::default()
..TaskDefinitionStable::default()
},
..BookkeepingTaskDefinition::default()
}
Expand Down Expand Up @@ -703,7 +703,7 @@ mod tests {
defined_fields: ["Persistent".to_string()].into_iter().collect(),
experimental_fields: HashSet::new(),
experimental: TaskDefinitionExperiments::default(),
task_definition: TaskDefinitionHashable::default()
task_definition: TaskDefinitionStable::default()
}
)]
#[test_case(
Expand Down Expand Up @@ -743,7 +743,7 @@ mod tests {
].into_iter().collect(),
experimental_fields: HashSet::new(),
experimental: TaskDefinitionExperiments {},
task_definition: TaskDefinitionHashable {
task_definition: TaskDefinitionStable {
dot_env: vec![RelativeUnixPathBuf::new("package/a/.env").unwrap()],
env: vec!["OS".to_string()],
outputs: TaskOutputs {
Expand All @@ -753,7 +753,7 @@ mod tests {
cache: false,
inputs: vec!["package/a/src/**".to_string()],
output_mode: OutputLogsMode::Full,
pass_through_env: vec!["AWS_SECRET_KEY".to_string()],
pass_through_env: Some(vec!["AWS_SECRET_KEY".to_string()]),
task_dependencies: vec!["cli#build".into()],
topological_dependencies: vec![],
persistent: true,
Expand Down
10 changes: 6 additions & 4 deletions crates/turborepo-lib/src/engine/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,10 @@ mod test {
WorkspaceName::Root,
turbo_json(json!({
"pipeline": {
"libA#build": { "dependsOn": ["app1#compile", "app1#build"] },
"libA#build": { "dependsOn": ["app1#compile", "app1#test"] },
"build": { "dependsOn": ["^build"] },
"compile": { "dependsOn": ["^build"] }
"compile": {},
"test": {}
}
})),
)]
Expand All @@ -901,9 +902,10 @@ mod test {
.unwrap();

let expected = deps! {
"app1#compile" => ["___ROOT___"],
"app1#test" => ["___ROOT___"],
"app1#build" => ["libA#build"],
"app1#compile" => ["libA#build"],
"libA#build" => ["app1#build", "app1#compile"]
"libA#build" => ["app1#compile", "app1#test"]
};
assert_eq!(all_dependencies(&engine), expected);
}
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-lib/src/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ mod test {
let task_hashable = TaskHashable {
global_hash: "global_hash",
task_dependency_hashes: vec!["task_dependency_hash".to_string()],
package_dir: turbopath::RelativeUnixPathBuf::new("package_dir").unwrap(),
package_dir: Some(turbopath::RelativeUnixPathBuf::new("package_dir").unwrap()),
hash_of_files: "hash_of_files",
external_deps_hash: "external_deps_hash".to_string(),
external_deps_hash: Some("external_deps_hash".to_string()),
task: "task",
outputs: TaskOutputs {
inclusions: vec!["inclusions".to_string()],
Expand All @@ -423,7 +423,7 @@ mod test {
)]
.into_iter()
.collect(),
root_external_dependencies_hash: "0000000000000000".to_string(),
root_external_dependencies_hash: Some("0000000000000000".to_string()),
env: &["env".to_string()],
resolved_env_vars: vec![],
pass_through_env: &["pass_through_env".to_string()],
Expand Down
7 changes: 5 additions & 2 deletions crates/turborepo-lib/src/package_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ mod test {

assert_matches!(
pkg_graph.validate(),
Err(builder::Error::CyclicDependencies(_))
Err(builder::Error::Graph(graph::Error::CyclicDependencies(_)))
);
}

Expand Down Expand Up @@ -685,6 +685,9 @@ mod test {
.build()
.unwrap();

assert_matches!(pkg_graph.validate(), Err(builder::Error::SelfDependency(_)));
assert_matches!(
pkg_graph.validate(),
Err(builder::Error::Graph(graph::Error::SelfDependency(_)))
);
}
}
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use crate::{
process::ProcessManager,
run::global_hash::get_global_hash_inputs,
task_graph::Visitor,
task_hash::{PackageInputsHashes, TaskHashTracker},
task_hash::PackageInputsHashes,
};

#[derive(Debug)]
Expand Down

0 comments on commit c8ac30f

Please sign in to comment.