Skip to content

Commit 20ae8db

Browse files
authored
fix(repl): importing json files (denoland#26053)
Closes denoland#26041
1 parent 0dfd333 commit 20ae8db

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ license = "MIT"
4545
repository = "https://github.com/denoland/deno"
4646

4747
[workspace.dependencies]
48-
deno_ast = { version = "=0.42.1", features = ["transpiling"] }
48+
deno_ast = { version = "=0.42.2", features = ["transpiling"] }
4949
deno_core = { version = "0.311.0" }
5050

5151
deno_bench_util = { version = "0.165.0", path = "./bench_util" }

tests/integration/repl_tests.rs

+19
Original file line numberDiff line numberDiff line change
@@ -1136,3 +1136,22 @@ fn eval_file_promise_error() {
11361136
assert_contains!(out, "Uncaught undefined");
11371137
assert!(err.is_empty());
11381138
}
1139+
1140+
#[test]
1141+
fn repl_json_imports() {
1142+
let context = TestContextBuilder::default().use_temp_cwd().build();
1143+
let temp_dir = context.temp_dir();
1144+
temp_dir.write("./data.json", r#"{"hello": "world"}"#);
1145+
context
1146+
.new_command()
1147+
.env("NO_COLOR", "1")
1148+
.args_vec(["repl", "-A"])
1149+
.with_pty(|mut console| {
1150+
console.write_line_raw(
1151+
"import data from './data.json' with { type: 'json' };",
1152+
);
1153+
console.expect("undefined");
1154+
console.write_line_raw("data");
1155+
console.expect(r#"{ hello: "world" }"#);
1156+
});
1157+
}

0 commit comments

Comments
 (0)