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 /tests/integration | |
parent | 0dfd333649acd85508e62bb60e3be4946e543597 (diff) |
fix(repl): importing json files (#26053)
Closes https://github.com/denoland/deno/issues/26041
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/repl_tests.rs | 19 |
1 files changed, 19 insertions, 0 deletions
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" }"#); + }); +} |