Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(infer): add test for current behavior #8825

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions crates/turborepo-repository/src/inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,28 @@
PackageManager::Npm
);
}

fn test_gh_8599() {

Check warning on line 351 in crates/turborepo-repository/src/inference.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on ubuntu

function `test_gh_8599` is never used

Check warning on line 351 in crates/turborepo-repository/src/inference.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on macos

function `test_gh_8599` is never used

Check warning on line 351 in crates/turborepo-repository/src/inference.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on windows

function `test_gh_8599` is never used
// TODO: this test documents existing broken behavior, when we have time we
// should fix this and update the assertions
let (_tmp, tmp_dir) = tmp_dir();
let monorepo_root = tmp_dir.join_component("monorepo_root");
let monorepo_pkg_json = monorepo_root.join_component("package.json");
monorepo_pkg_json.ensure_dir().unwrap();
monorepo_pkg_json.create_with_contents(r#"{"name": "mono", "packageManager": "[email protected]", "workspaces": ["./packages/*"]}"#.as_bytes()).unwrap();
let package_foo = monorepo_root.join_components(&["packages", "foo"]);
let foo_package_json = package_foo.join_component("package.json");
foo_package_json.ensure_dir().unwrap();
foo_package_json
.create_with_contents(r#"{"name": "foo"}"#.as_bytes())
.unwrap();

let repo_state = RepoState::infer(&package_foo).unwrap();
// These assertions are the buggy behavior
assert_eq!(repo_state.root, package_foo);
assert_eq!(repo_state.mode, RepoMode::SinglePackage);
// TODO: the following assertions are the correct behavior
// assert_eq!(repo_state.root, monorepo_root);
// assert_eq!(repo_state.mode, RepoMode::MultiPackage);
}
}
Loading