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.rs32
1 files changed, 21 insertions, 11 deletions
diff --git a/cli/tools/test.rs b/cli/tools/test.rs
index 12f5d7c1f..d200a3029 100644
--- a/cli/tools/test.rs
+++ b/cli/tools/test.rs
@@ -740,6 +740,7 @@ async fn test_specifier(
}
fn extract_files_from_regex_blocks(
+ current_dir: &Path,
specifier: &ModuleSpecifier,
source: &str,
media_type: MediaType,
@@ -799,13 +800,16 @@ fn extract_files_from_regex_blocks(
writeln!(file_source, "{}", text.as_str()).unwrap();
}
- let file_specifier = deno_core::resolve_url_or_path_deprecated(&format!(
- "{}${}-{}{}",
- specifier,
- file_line_index + line_offset + 1,
- file_line_index + line_offset + line_count + 1,
- file_media_type.as_ts_extension(),
- ))
+ let file_specifier = deno_core::resolve_url_or_path(
+ &format!(
+ "{}${}-{}{}",
+ specifier,
+ file_line_index + line_offset + 1,
+ file_line_index + line_offset + line_count + 1,
+ file_media_type.as_ts_extension(),
+ ),
+ current_dir,
+ )
.unwrap();
Some(File {
@@ -823,6 +827,7 @@ fn extract_files_from_regex_blocks(
}
fn extract_files_from_source_comments(
+ current_dir: &Path,
specifier: &ModuleSpecifier,
source: Arc<str>,
media_type: MediaType,
@@ -850,6 +855,7 @@ fn extract_files_from_source_comments(
})
.flat_map(|comment| {
extract_files_from_regex_blocks(
+ current_dir,
specifier,
&comment.text,
media_type,
@@ -865,6 +871,7 @@ fn extract_files_from_source_comments(
}
fn extract_files_from_fenced_blocks(
+ current_dir: &Path,
specifier: &ModuleSpecifier,
source: &str,
media_type: MediaType,
@@ -878,6 +885,7 @@ fn extract_files_from_fenced_blocks(
let lines_regex = Regex::new(r"(?:\# ?)?(.*)")?;
extract_files_from_regex_blocks(
+ current_dir,
specifier,
source,
media_type,
@@ -898,12 +906,14 @@ async fn fetch_inline_files(
let inline_files = if file.media_type == MediaType::Unknown {
extract_files_from_fenced_blocks(
+ ps.options.initial_cwd(),
&file.specifier,
&file.source,
file.media_type,
)
} else {
extract_files_from_source_comments(
+ ps.options.initial_cwd(),
&file.specifier,
file.source,
file.media_type,
@@ -1427,10 +1437,10 @@ pub async fn run_tests_with_watch(
);
if let Some(changed) = &changed {
- for path in changed.iter().filter_map(|path| {
- deno_core::resolve_url_or_path_deprecated(&path.to_string_lossy())
- .ok()
- }) {
+ for path in changed
+ .iter()
+ .filter_map(|path| ModuleSpecifier::from_file_path(path).ok())
+ {
if modules.contains(&path) {
modules_to_reload.push(specifier);
break;