summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-08-13 18:06:49 +0800
committerGitHub <noreply@github.com>2021-08-13 12:06:49 +0200
commitebb79b28a5e1689a1d198082b35d37a4541d2a90 (patch)
treecd0c4c4657cd7e180ada15988387a1be3984ac47 /cli/main.rs
parent293eed0ef2de1bf1563811e3a1fe3fafb436636d (diff)
refactor(cli): generalize module specifier collection (#11679)
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs20
1 files changed, 6 insertions, 14 deletions
diff --git a/cli/main.rs b/cli/main.rs
index da40e4528..9191ab86b 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -1019,7 +1019,6 @@ async fn test_command(
let program_state = ProgramState::build(flags.clone()).await?;
let include = include.unwrap_or_else(|| vec![".".to_string()]);
- let cwd = std::env::current_dir().expect("No current directory");
let permissions = Permissions::from_options(&flags.clone().into());
let lib = if flags.unstable {
@@ -1040,15 +1039,13 @@ async fn test_command(
// TODO(caspervonb) clean this up.
let resolver = |changed: Option<Vec<PathBuf>>| {
let test_modules_result = if doc {
- test_runner::collect_test_module_specifiers(
+ fs_util::collect_specifiers(
include.clone(),
- &cwd,
fs_util::is_supported_ext_test,
)
} else {
- test_runner::collect_test_module_specifiers(
+ fs_util::collect_specifiers(
include.clone(),
- &cwd,
tools::test_runner::is_supported,
)
};
@@ -1173,7 +1170,6 @@ async fn test_command(
};
let operation = |modules_to_reload: Vec<ModuleSpecifier>| {
- let cwd = cwd.clone();
let filter = filter.clone();
let include = include.clone();
let lib = lib.clone();
@@ -1182,9 +1178,8 @@ async fn test_command(
async move {
let doc_modules = if doc {
- test_runner::collect_test_module_specifiers(
+ fs_util::collect_specifiers(
include.clone(),
- &cwd,
fs_util::is_supported_ext_test,
)?
} else {
@@ -1197,9 +1192,8 @@ async fn test_command(
.cloned()
.collect();
- let test_modules = test_runner::collect_test_module_specifiers(
+ let test_modules = fs_util::collect_specifiers(
include.clone(),
- &cwd,
tools::test_runner::is_supported,
)?;
@@ -1232,18 +1226,16 @@ async fn test_command(
file_watcher::watch_func(resolver, operation, "Test").await?;
} else {
let doc_modules = if doc {
- test_runner::collect_test_module_specifiers(
+ fs_util::collect_specifiers(
include.clone(),
- &cwd,
fs_util::is_supported_ext_test,
)?
} else {
Vec::new()
};
- let test_modules = test_runner::collect_test_module_specifiers(
+ let test_modules = fs_util::collect_specifiers(
include.clone(),
- &cwd,
tools::test_runner::is_supported,
)?;