summaryrefslogtreecommitdiff
path: root/cli/tools/test.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools/test.rs')
-rw-r--r--cli/tools/test.rs34
1 files changed, 16 insertions, 18 deletions
diff --git a/cli/tools/test.rs b/cli/tools/test.rs
index 2cc1ac808..5d99677f2 100644
--- a/cli/tools/test.rs
+++ b/cli/tools/test.rs
@@ -702,7 +702,7 @@ async fn fetch_inline_files(
/// Type check a collection of module and document specifiers.
async fn check_specifiers(
- ps: ProcState,
+ ps: &ProcState,
permissions: Permissions,
specifiers: Vec<(ModuleSpecifier, TestMode)>,
lib: emit::TypeLib,
@@ -972,7 +972,7 @@ fn collect_specifiers_with_test_mode(
/// cannot be run, and therefore need to be marked as `TestMode::Documentation`
/// as well.
async fn fetch_specifiers_with_test_mode(
- ps: ProcState,
+ ps: &ProcState,
include: Vec<String>,
ignore: Vec<PathBuf>,
include_inline: bool,
@@ -999,10 +999,10 @@ pub async fn run_tests(
flags: Flags,
test_flags: TestFlags,
) -> Result<(), AnyError> {
- let ps = ProcState::build(flags.clone()).await?;
- let permissions = Permissions::from_options(&flags.clone().into());
+ let ps = ProcState::build(Arc::new(flags)).await?;
+ let permissions = Permissions::from_options(&ps.flags.permissions_options());
let specifiers_with_mode = fetch_specifiers_with_test_mode(
- ps.clone(),
+ &ps,
test_flags.include.unwrap_or_else(|| vec![".".to_string()]),
test_flags.ignore.clone(),
test_flags.doc,
@@ -1013,30 +1013,26 @@ pub async fn run_tests(
return Err(generic_error("No test modules found"));
}
- let lib = if flags.unstable {
+ let lib = if ps.flags.unstable {
emit::TypeLib::UnstableDenoWindow
} else {
emit::TypeLib::DenoWindow
};
- check_specifiers(
- ps.clone(),
- permissions.clone(),
- specifiers_with_mode.clone(),
- lib,
- )
- .await?;
+ check_specifiers(&ps, permissions.clone(), specifiers_with_mode.clone(), lib)
+ .await?;
if test_flags.no_run {
return Ok(());
}
+ let compat = ps.flags.compat;
test_specifiers(
ps,
permissions,
specifiers_with_mode,
TestSpecifierOptions {
- compat_mode: flags.compat,
+ compat_mode: compat,
concurrent_jobs: test_flags.concurrent_jobs,
fail_fast: test_flags.fail_fast,
filter: test_flags.filter,
@@ -1052,8 +1048,9 @@ pub async fn run_tests_with_watch(
flags: Flags,
test_flags: TestFlags,
) -> Result<(), AnyError> {
+ let flags = Arc::new(flags);
let ps = ProcState::build(flags.clone()).await?;
- let permissions = Permissions::from_options(&flags.clone().into());
+ let permissions = Permissions::from_options(&flags.permissions_options());
let lib = if flags.unstable {
emit::TypeLib::UnstableDenoWindow
@@ -1233,6 +1230,7 @@ pub async fn run_tests_with_watch(
};
let operation = |modules_to_reload: Vec<(ModuleSpecifier, ModuleKind)>| {
+ let flags = flags.clone();
let filter = test_flags.filter.clone();
let include = include.clone();
let ignore = ignore.clone();
@@ -1242,7 +1240,7 @@ pub async fn run_tests_with_watch(
async move {
let specifiers_with_mode = fetch_specifiers_with_test_mode(
- ps.clone(),
+ &ps,
include.clone(),
ignore.clone(),
test_flags.doc,
@@ -1256,7 +1254,7 @@ pub async fn run_tests_with_watch(
.collect::<Vec<(ModuleSpecifier, TestMode)>>();
check_specifiers(
- ps.clone(),
+ &ps,
permissions.clone(),
specifiers_with_mode.clone(),
lib,
@@ -1268,7 +1266,7 @@ pub async fn run_tests_with_watch(
}
test_specifiers(
- ps.clone(),
+ ps,
permissions.clone(),
specifiers_with_mode,
TestSpecifierOptions {