diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-10-09 09:04:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-09 10:04:44 +0200 |
commit | 20ae8db50d7d48ad020b83ebe78dc0e9e9eab3b2 (patch) | |
tree | 32076d083f7ed339dcf080fa535cbf6e3c0fd1ed | |
parent | 0dfd333649acd85508e62bb60e3be4946e543597 (diff) |
fix(repl): importing json files (#26053)
Closes https://github.com/denoland/deno/issues/26041
-rw-r--r-- | Cargo.lock | 4 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | tests/integration/repl_tests.rs | 19 |
3 files changed, 22 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock index c5abeb3d4..c559611cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1283,9 +1283,9 @@ dependencies = [ [[package]] name = "deno_ast" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ea2fd038c9c7e3e87e624fd708303cd33f39c33707f6c48fa9a65d65fefc47" +checksum = "b2b9d03b1bbeeecdac54367f075d572131736d06c5be3bc49037855bc5ab1bbb" dependencies = [ "base64 0.21.7", "deno_media_type", diff --git a/Cargo.toml b/Cargo.toml index d811d44b5..badc84992 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ license = "MIT" repository = "https://github.com/denoland/deno" [workspace.dependencies] -deno_ast = { version = "=0.42.1", features = ["transpiling"] } +deno_ast = { version = "=0.42.2", features = ["transpiling"] } deno_core = { version = "0.311.0" } deno_bench_util = { version = "0.165.0", path = "./bench_util" } diff --git a/tests/integration/repl_tests.rs b/tests/integration/repl_tests.rs index 3f137ce7c..4e00398ce 100644 --- a/tests/integration/repl_tests.rs +++ b/tests/integration/repl_tests.rs @@ -1136,3 +1136,22 @@ fn eval_file_promise_error() { assert_contains!(out, "Uncaught undefined"); assert!(err.is_empty()); } + +#[test] +fn repl_json_imports() { + let context = TestContextBuilder::default().use_temp_cwd().build(); + let temp_dir = context.temp_dir(); + temp_dir.write("./data.json", r#"{"hello": "world"}"#); + context + .new_command() + .env("NO_COLOR", "1") + .args_vec(["repl", "-A"]) + .with_pty(|mut console| { + console.write_line_raw( + "import data from './data.json' with { type: 'json' };", + ); + console.expect("undefined"); + console.write_line_raw("data"); + console.expect(r#"{ hello: "world" }"#); + }); +} |