Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Jul 30, 2023
1 parent beb3197 commit b6c742b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
46 changes: 26 additions & 20 deletions crates/node/platform/tests/project_aliases_test.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use moon::{generate_project_graph, load_workspace_from};
use moon_common::Id;
use moon_project_graph::ProjectGraph;
use moon_test_utils::{
assert_snapshot, create_sandbox_with_config, get_project_graph_aliases_fixture_configs, Sandbox,
};
// use rustc_hash::FxHashMap;
use rustc_hash::FxHashMap;

async fn get_aliases_graph() -> (ProjectGraph, Sandbox) {
let (workspace_config, toolchain_config, tasks_config) =
Expand All @@ -22,26 +23,31 @@ async fn get_aliases_graph() -> (ProjectGraph, Sandbox) {
(graph, sandbox)
}

// TODO
// #[tokio::test]
// async fn loads_node_aliases_name_scopes() {
// let (graph, _sandbox) = get_aliases_graph().await;
#[tokio::test]
async fn loads_node_aliases_name_scopes() {
let (graph, _sandbox) = get_aliases_graph().await;

// assert_eq!(
// graph.aliases,
// FxHashMap::from_iter([
// ("project-graph-aliases-explicit".into(), "explicit".into()),
// (
// "project-graph-aliases-explicit-and-implicit".into(),
// "explicitAndImplicit".into()
// ),
// ("project-graph-aliases-implicit".into(), "implicit".into()),
// ("project-graph-aliases-node".into(), "node".into()),
// ("pkg-bar".into(), "nodeNameOnly".into()),
// ("@scope/pkg-foo".into(), "nodeNameScope".into())
// ])
// );
// }
assert_eq!(
graph.aliases(),
FxHashMap::from_iter([
(
"project-graph-aliases-explicit",
&Id::raw("explicit")
),
(
"project-graph-aliases-explicit-and-implicit",
&Id::raw("explicitAndImplicit")
),
(
"project-graph-aliases-implicit",
&Id::raw("implicit")
),
("project-graph-aliases-node", &Id::raw("node")),
("pkg-bar", &Id::raw("nodeNameOnly")),
("@scope/pkg-foo", &Id::raw("nodeNameScope"))
])
);
}

#[tokio::test]
async fn returns_project_using_alias() {
Expand Down
6 changes: 6 additions & 0 deletions nextgen/project-expander/tests/tasks_expander_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,8 @@ mod tasks_expander {
expected = "Tasks example:target, project:task have configured the same output"
)]
fn errors_overlapping_file() {
env::remove_var("MOON_DISABLE_OVERLAPPING_OUTPUTS");

let sandbox = create_sandbox("file-group");
let project = create_project(sandbox.path());

Expand All @@ -983,6 +985,8 @@ mod tasks_expander {
expected = "Tasks example:target, project:task have configured the same output"
)]
fn errors_overlapping_glob() {
env::remove_var("MOON_DISABLE_OVERLAPPING_OUTPUTS");

let sandbox = create_sandbox("file-group");
let project = create_project(sandbox.path());

Expand All @@ -1008,6 +1012,8 @@ mod tasks_expander {
expected = "Tasks example:target, project:task have configured the same output"
)]
fn errors_overlapping_glob_matching_file() {
env::remove_var("MOON_DISABLE_OVERLAPPING_OUTPUTS");

let sandbox = create_sandbox("file-group");
let project = create_project(sandbox.path());

Expand Down
2 changes: 2 additions & 0 deletions nextgen/project-graph/tests/project_graph_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,8 @@ mod project_graph {
#[tokio::test]
#[should_panic(expected = "Tasks a:base, a:other have configured the same output a/out.")]
async fn errors_overlapping_outputs() {
std::env::remove_var("MOON_DISABLE_OVERLAPPING_OUTPUTS");

generate_project_graph("boundaries/overlapping-outputs").await;
}
}
Expand Down

0 comments on commit b6c742b

Please sign in to comment.