Skip to content

Commit 9486162

Browse files
committed
test(config): publish concurrency fixtures atomically
1 parent ba58f2c commit 9486162

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/config/sessions/session-accessor.reply-init-concurrency.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ async function waitForFile(filePath) {
8484
}
8585
8686
async function writeJsonFile(filePath, value) {
87-
await fs.writeFile(filePath, \`\${JSON.stringify(value, null, 2)}\\n\`, "utf8");
87+
const tempPath = \`\${filePath}.\${process.pid}.tmp\`;
88+
await fs.writeFile(tempPath, \`\${JSON.stringify(value, null, 2)}\\n\`, "utf8");
89+
await fs.rename(tempPath, filePath);
8890
}
8991
9092
const storePath = process.env.REPLY_INIT_STORE_PATH;

0 commit comments

Comments
 (0)