From 56769b1246aa7ab57d3deee14c92b7646a77e2fa Mon Sep 17 00:00:00 2001 From: FrozenPandaz Date: Tue, 14 May 2024 11:15:40 -0400 Subject: [PATCH] chore(misc): fix failing remove unit tests --- .../project_graph/transfer_project_graph.rs | 1 - packages/nx/src/native/pseudo_terminal/mac.rs | 19 +++++++++++++++++-- .../nx/src/native/pseudo_terminal/non_mac.rs | 9 ++++++++- packages/nx/src/native/tasks/hashers.rs | 4 ++-- packages/nx/src/native/utils/path.rs | 12 ++++-------- packages/nx/src/native/watch/types.rs | 2 -- .../remove/lib/update-tsconfig.spec.ts | 5 +++++ 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/packages/nx/src/native/project_graph/transfer_project_graph.rs b/packages/nx/src/native/project_graph/transfer_project_graph.rs index b68bc78a07f11d..33de1f5605fdc7 100644 --- a/packages/nx/src/native/project_graph/transfer_project_graph.rs +++ b/packages/nx/src/native/project_graph/transfer_project_graph.rs @@ -8,4 +8,3 @@ use crate::native::project_graph::types::ProjectGraph; pub fn transfer_project_graph(project_graph: ProjectGraph) -> External { External::new(project_graph) } - diff --git a/packages/nx/src/native/pseudo_terminal/mac.rs b/packages/nx/src/native/pseudo_terminal/mac.rs index ea6b31baec947d..91441fc5d3dcc6 100644 --- a/packages/nx/src/native/pseudo_terminal/mac.rs +++ b/packages/nx/src/native/pseudo_terminal/mac.rs @@ -29,7 +29,15 @@ impl RustPseudoTerminal { tty: Option, ) -> napi::Result { let pseudo_terminal = create_pseudo_terminal()?; - run_command(&pseudo_terminal, command, command_dir, js_env, exec_argv, quiet, tty) + run_command( + &pseudo_terminal, + command, + command_dir, + js_env, + exec_argv, + quiet, + tty, + ) } /// This allows us to run a pseudoterminal with a fake node ipc channel @@ -53,6 +61,13 @@ impl RustPseudoTerminal { ); trace!("nx_fork command: {}", &command); - self.run_command(command, command_dir, js_env, exec_argv, Some(quiet), Some(true)) + self.run_command( + command, + command_dir, + js_env, + exec_argv, + Some(quiet), + Some(true), + ) } } diff --git a/packages/nx/src/native/pseudo_terminal/non_mac.rs b/packages/nx/src/native/pseudo_terminal/non_mac.rs index 8e7ff6695a7972..30285912ae7016 100644 --- a/packages/nx/src/native/pseudo_terminal/non_mac.rs +++ b/packages/nx/src/native/pseudo_terminal/non_mac.rs @@ -65,6 +65,13 @@ impl RustPseudoTerminal { ); trace!("nx_fork command: {}", &command); - self.run_command(command, command_dir, js_env, exec_argv, Some(quiet), Some(true)) + self.run_command( + command, + command_dir, + js_env, + exec_argv, + Some(quiet), + Some(true), + ) } } diff --git a/packages/nx/src/native/tasks/hashers.rs b/packages/nx/src/native/tasks/hashers.rs index 796e002a8e2464..f8cbff0906ce18 100644 --- a/packages/nx/src/native/tasks/hashers.rs +++ b/packages/nx/src/native/tasks/hashers.rs @@ -4,8 +4,8 @@ mod hash_project_config; mod hash_project_files; mod hash_runtime; mod hash_task_output; -mod hash_workspace_files; mod hash_tsconfig; +mod hash_workspace_files; pub use hash_env::*; pub use hash_external::*; @@ -13,5 +13,5 @@ pub use hash_project_config::*; pub use hash_project_files::*; pub use hash_runtime::*; pub use hash_task_output::*; +pub use hash_tsconfig::*; pub use hash_workspace_files::*; -pub use hash_tsconfig::*; \ No newline at end of file diff --git a/packages/nx/src/native/utils/path.rs b/packages/nx/src/native/utils/path.rs index 409f70a78aa2bd..2c0815fa34c56e 100644 --- a/packages/nx/src/native/utils/path.rs +++ b/packages/nx/src/native/utils/path.rs @@ -1,4 +1,4 @@ -use crate::native::{utils::normalize_trait::Normalize, types::FileData}; +use crate::native::{types::FileData, utils::normalize_trait::Normalize}; use std::path::{Path, PathBuf}; impl Normalize for Path { @@ -65,13 +65,9 @@ mod test { FileData { file: "foo-other/not-child".into(), hash: "123".into(), - } + }, ]; let child_files = get_child_files(&directory, files); - assert_eq!(child_files, [ - "foo/bar", - "foo/baz", - "foo/child/bar", - ]); + assert_eq!(child_files, ["foo/bar", "foo/baz", "foo/child/bar",]); } -} \ No newline at end of file +} diff --git a/packages/nx/src/native/watch/types.rs b/packages/nx/src/native/watch/types.rs index f5b6281c69f10c..3a4f82c9b6c2a8 100644 --- a/packages/nx/src/native/watch/types.rs +++ b/packages/nx/src/native/watch/types.rs @@ -158,8 +158,6 @@ pub fn transform_event_to_watch_events( } } } - - } fn create_watch_event_internal( diff --git a/packages/workspace/src/generators/remove/lib/update-tsconfig.spec.ts b/packages/workspace/src/generators/remove/lib/update-tsconfig.spec.ts index 66196252613d44..01277a7d4d78de 100644 --- a/packages/workspace/src/generators/remove/lib/update-tsconfig.spec.ts +++ b/packages/workspace/src/generators/remove/lib/update-tsconfig.spec.ts @@ -38,6 +38,11 @@ describe('updateTsconfig', () => { forceRemove: false, importPath: '@proj/whatever-name', }; + + graph = { + nodes: {}, + dependencies: {}, + }; }); it('should delete project ref from the root tsconfig.base.json', async () => {