mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(cli/test): decoding percent-encoding(non-ASCII) file path correctly (#23200)
# Summary This PR resolves about the issue. fixes #10810 And the formerly context is in the PR. #22582 Here is an expected behaviour example with this change. - 🦕.test.ts ```ts import { assertEquals } from "https://deno.land/std@0.215.0/assert/mod.ts"; Deno.test("example test", () => { assertEquals("🍋", "🦕"); }); ```
This commit is contained in:
parent
dc5c799c39
commit
9aa593cd5d
3 changed files with 52 additions and 2 deletions
|
@ -27,6 +27,7 @@ use crate::graph_util::ModuleGraphBuilder;
|
|||
use crate::npm::CliNpmResolver;
|
||||
use crate::tsc;
|
||||
use crate::tsc::Diagnostics;
|
||||
use crate::util::path::to_percent_decoded_str;
|
||||
use crate::version;
|
||||
|
||||
/// Options for performing a check of a module graph. Note that the decision to
|
||||
|
@ -154,7 +155,11 @@ impl TypeChecker {
|
|||
|
||||
for root in &graph.roots {
|
||||
let root_str = root.as_str();
|
||||
log::info!("{} {}", colors::green("Check"), root_str);
|
||||
log::info!(
|
||||
"{} {}",
|
||||
colors::green("Check"),
|
||||
to_percent_decoded_str(root_str)
|
||||
);
|
||||
}
|
||||
|
||||
let check_js = ts_config.get_check_js();
|
||||
|
|
|
@ -8,6 +8,8 @@ use phf::phf_map;
|
|||
use std::borrow::Cow;
|
||||
use std::ops::AddAssign;
|
||||
|
||||
use crate::util::path::to_percent_decoded_str;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub fn to_relative_path_or_remote_url(cwd: &Url, path_or_url: &str) -> String {
|
||||
|
@ -19,7 +21,7 @@ pub fn to_relative_path_or_remote_url(cwd: &Url, path_or_url: &str) -> String {
|
|||
if !r.starts_with("../") {
|
||||
r = format!("./{r}");
|
||||
}
|
||||
return r;
|
||||
return to_percent_decoded_str(&r);
|
||||
}
|
||||
}
|
||||
path_or_url.to_string()
|
||||
|
|
|
@ -63,6 +63,49 @@ itest!(fail {
|
|||
output: "test/fail.out",
|
||||
});
|
||||
|
||||
// GHA CI seems to have a problem with Emoji
|
||||
// https://github.com/denoland/deno/pull/23200#issuecomment-2134032695
|
||||
#[test]
|
||||
fn fail_with_contain_unicode_filename() {
|
||||
let context = TestContextBuilder::new().use_temp_cwd().build();
|
||||
let temp_dir = context.temp_dir();
|
||||
temp_dir.write(
|
||||
"fail_with_contain_unicode_filename🦕.ts",
|
||||
"Deno.test(\"test 0\", () => {
|
||||
throw new Error();
|
||||
});
|
||||
",
|
||||
);
|
||||
let output = context
|
||||
.new_command()
|
||||
.args("test fail_with_contain_unicode_filename🦕.ts")
|
||||
.run();
|
||||
output.skip_output_check();
|
||||
output.assert_exit_code(1);
|
||||
output.assert_matches_text(
|
||||
"Check [WILDCARD]/fail_with_contain_unicode_filename🦕.ts
|
||||
running 1 test from ./fail_with_contain_unicode_filename🦕.ts
|
||||
test 0 ... FAILED ([WILDCARD])
|
||||
|
||||
ERRORS
|
||||
|
||||
test 0 => ./fail_with_contain_unicode_filename🦕.ts:[WILDCARD]
|
||||
error: Error
|
||||
throw new Error();
|
||||
^
|
||||
at [WILDCARD]/fail_with_contain_unicode_filename%F0%9F%A6%95.ts:[WILDCARD]
|
||||
|
||||
FAILURES
|
||||
|
||||
test 0 => ./fail_with_contain_unicode_filename🦕.ts:[WILDCARD]
|
||||
|
||||
FAILED | 0 passed | 1 failed ([WILDCARD])
|
||||
|
||||
error: Test failed
|
||||
",
|
||||
);
|
||||
}
|
||||
|
||||
itest!(collect {
|
||||
args: "test --ignore=test/collect/ignore test/collect",
|
||||
exit_code: 0,
|
||||
|
|
Loading…
Add table
Reference in a new issue