summaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-10-09 09:04:44 +0100
committerGitHub <noreply@github.com>2024-10-09 10:04:44 +0200
commit20ae8db50d7d48ad020b83ebe78dc0e9e9eab3b2 (patch)
tree32076d083f7ed339dcf080fa535cbf6e3c0fd1ed /tests/integration
parent0dfd333649acd85508e62bb60e3be4946e543597 (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.rs19
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" }"#);
+ });
+}