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.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/cli/tools/test.rs b/cli/tools/test.rs
index 08000c765..e680d5718 100644
--- a/cli/tools/test.rs
+++ b/cli/tools/test.rs
@@ -44,6 +44,7 @@ use rand::seq::SliceRandom;
use rand::SeedableRng;
use regex::Regex;
use serde::Deserialize;
+use std::cell::RefCell;
use std::collections::BTreeMap;
use std::collections::HashSet;
use std::fmt::Write as _;
@@ -955,7 +956,6 @@ pub async fn check_specifiers(
lib,
PermissionsContainer::new(Permissions::allow_all()),
PermissionsContainer::new(permissions.clone()),
- false,
)
.await?;
}
@@ -977,7 +977,6 @@ pub async fn check_specifiers(
lib,
PermissionsContainer::allow_all(),
PermissionsContainer::new(permissions),
- true,
)
.await?;
@@ -1353,12 +1352,14 @@ pub async fn run_tests_with_watch(
Permissions::from_options(&ps.options.permissions_options())?;
let no_check = ps.options.type_check_mode() == TypeCheckMode::None;
+ let ps = RefCell::new(ps);
+
let resolver = |changed: Option<Vec<PathBuf>>| {
let paths_to_watch = test_options.files.include.clone();
let paths_to_watch_clone = paths_to_watch.clone();
let files_changed = changed.is_some();
let test_options = &test_options;
- let ps = ps.clone();
+ let ps = ps.borrow().clone();
async move {
let test_modules = if test_options.doc {
@@ -1466,7 +1467,8 @@ pub async fn run_tests_with_watch(
let operation = |modules_to_reload: Vec<ModuleSpecifier>| {
let permissions = &permissions;
let test_options = &test_options;
- let ps = ps.clone();
+ ps.borrow_mut().reset_for_file_watcher();
+ let ps = ps.borrow().clone();
async move {
let specifiers_with_mode = fetch_specifiers_with_test_mode(
@@ -1502,12 +1504,13 @@ pub async fn run_tests_with_watch(
}
};
+ let clear_screen = !ps.borrow().options.no_clear_screen();
file_watcher::watch_func(
resolver,
operation,
file_watcher::PrintConfig {
job_name: "Test".to_string(),
- clear_screen: !ps.options.no_clear_screen(),
+ clear_screen,
},
)
.await?;