summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-02-01 15:57:02 -0500
committerGitHub <noreply@github.com>2023-02-01 15:57:02 -0500
commitf6f76a76b2b06c6546bb00117e61f4c743d1eba6 (patch)
treefecd07fd42f238da398fe9e29478d4b173015382
parent690b6ac39eaae2f0cbdd714d5b025d865915fd0c (diff)
fix(lockfile): emit trailing newline (#17618)
-rw-r--r--cli/tests/integration/npm_tests.rs3
-rw-r--r--lockfile/lib.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs
index 36559b706..107bab613 100644
--- a/cli/tests/integration/npm_tests.rs
+++ b/cli/tests/integration/npm_tests.rs
@@ -1306,7 +1306,8 @@ fn lock_file_lock_write() {
}
}
}
-}"#;
+}
+"#;
temp_dir.write("deno.lock", lock_file_content);
let deno = util::deno_cmd_with_deno_dir(&deno_dir)
diff --git a/lockfile/lib.rs b/lockfile/lib.rs
index ec91def15..b8caac86c 100644
--- a/lockfile/lib.rs
+++ b/lockfile/lib.rs
@@ -187,7 +187,8 @@ impl Lockfile {
return Ok(());
}
- let json_string = serde_json::to_string_pretty(&self.content).unwrap();
+ let mut json_string = serde_json::to_string_pretty(&self.content).unwrap();
+ json_string.push('\n'); // trailing newline in file
let mut f = std::fs::OpenOptions::new()
.write(true)
.create(true)