From 6b95c53e48a2622f4f2b6fdfa6c2c26dc30bbba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 26 Mar 2024 21:40:24 +0000 Subject: feat(add): always produce multiline config file (#23077) This commit changes `deno add` to always produce a multiline config file. In v1.41.3: ``` $ mkdir foo $ cd foo $ deno add @std/assert Created deno.json configuration file. Add @std/assert - jsr:@std/assert@^0.220.0 $ cat deno.json { "imports": { "@std/assert": "jsr:@std/assert@^0.220.0" } } ``` Now: ``` $ mkdir foo $ cd foo $ deno add @std/assert Created deno.json configuration file. Add @std/assert - jsr:@std/assert@^0.220.0 $ cat deno.json { "imports": { "@std/assert": "jsr:@std/assert@^0.220.0" } } ``` --- tests/integration/pm_tests.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tests/integration/pm_tests.rs') diff --git a/tests/integration/pm_tests.rs b/tests/integration/pm_tests.rs index 668519bdc..a8af67e5b 100644 --- a/tests/integration/pm_tests.rs +++ b/tests/integration/pm_tests.rs @@ -39,11 +39,14 @@ fn add_basic_no_deno_json() { output.assert_exit_code(0); let output = output.combined_output(); assert_contains!(output, "Add @denotest/add"); - temp_dir.join("deno.json").assert_matches_json(json!({ - "imports": { - "@denotest/add": "jsr:@denotest/add@^1.0.0" - } - })); + // Don't use `assert_matches_json` to ensure the file is properly formatted. + let expected = r#"{ + "imports": { + "@denotest/add": "jsr:@denotest/add@^1.0.0" + } +} +"#; + temp_dir.join("deno.json").assert_matches_text(expected); } #[test] -- cgit v1.2.3