summaryrefslogtreecommitdiff
path: root/cli/tools/test/mod.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-05-16 00:09:35 -0700
committerGitHub <noreply@github.com>2024-05-16 07:09:35 +0000
commit88983fb3eb5a085f7d358a7a98d5c738a21b5d27 (patch)
treed4d83c5bd668edc25d30616fd4a3decc1cea3fb9 /cli/tools/test/mod.rs
parentbba553bea5938932518dc6382e464968ce8374b4 (diff)
fix(node): seperate worker module cache (#23634)
Construct a new module graph container for workers instead of sharing it with the main worker. Fixes #17248 Fixes #23461 --------- Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'cli/tools/test/mod.rs')
-rw-r--r--cli/tools/test/mod.rs27
1 files changed, 10 insertions, 17 deletions
diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs
index 94d4caee0..2ff7203b7 100644
--- a/cli/tools/test/mod.rs
+++ b/cli/tools/test/mod.rs
@@ -10,8 +10,8 @@ use crate::factory::CliFactory;
use crate::factory::CliFactoryBuilder;
use crate::file_fetcher::File;
use crate::file_fetcher::FileFetcher;
+use crate::graph_container::MainModuleGraphContainer;
use crate::graph_util::has_graph_root_local_dependent_changed;
-use crate::module_loader::ModuleLoadPreparer;
use crate::ops;
use crate::util::file_watcher;
use crate::util::fs::collect_specifiers;
@@ -1305,12 +1305,10 @@ async fn fetch_inline_files(
/// Type check a collection of module and document specifiers.
pub async fn check_specifiers(
- cli_options: &CliOptions,
file_fetcher: &FileFetcher,
- module_load_preparer: &ModuleLoadPreparer,
+ main_graph_container: &Arc<MainModuleGraphContainer>,
specifiers: Vec<(ModuleSpecifier, TestMode)>,
) -> Result<(), AnyError> {
- let lib = cli_options.ts_type_lib_window();
let inline_files = fetch_inline_files(
file_fetcher,
specifiers
@@ -1346,13 +1344,8 @@ pub async fn check_specifiers(
}
}
- module_load_preparer
- .prepare_module_load(
- module_specifiers,
- false,
- lib,
- PermissionsContainer::allow_all(),
- )
+ main_graph_container
+ .check_specifiers(&module_specifiers)
.await?;
Ok(())
@@ -1701,7 +1694,6 @@ pub async fn run_tests(
let cli_options = factory.cli_options();
let test_options = cli_options.resolve_test_options(test_flags)?;
let file_fetcher = factory.file_fetcher()?;
- let module_load_preparer = factory.module_load_preparer().await?;
// Various test files should not share the same permissions in terms of
// `PermissionsContainer` - otherwise granting/revoking permissions in one
// file would have impact on other files, which is undesirable.
@@ -1721,10 +1713,11 @@ pub async fn run_tests(
return Err(generic_error("No test modules found"));
}
+ let main_graph_container = factory.main_module_graph_container().await?;
+
check_specifiers(
- cli_options,
file_fetcher,
- module_load_preparer,
+ main_graph_container,
specifiers_with_mode.clone(),
)
.await?;
@@ -1863,7 +1856,6 @@ pub async fn run_tests_with_watch(
let worker_factory =
Arc::new(factory.create_cli_main_worker_factory().await?);
- let module_load_preparer = factory.module_load_preparer().await?;
let specifiers_with_mode = fetch_specifiers_with_test_mode(
&cli_options,
file_fetcher,
@@ -1875,10 +1867,11 @@ pub async fn run_tests_with_watch(
.filter(|(specifier, _)| test_modules_to_reload.contains(specifier))
.collect::<Vec<(ModuleSpecifier, TestMode)>>();
+ let main_graph_container =
+ factory.main_module_graph_container().await?;
check_specifiers(
- &cli_options,
file_fetcher,
- module_load_preparer,
+ main_graph_container,
specifiers_with_mode.clone(),
)
.await?;