From 5436c7369c7e3b3ae46898ff83078f7ed660bd9d Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 10 Apr 2023 17:14:59 +0200 Subject: [PATCH] fix(snapshot): improve `skipWriting` check --- packages/snapshot/src/port/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/snapshot/src/port/utils.ts b/packages/snapshot/src/port/utils.ts index 0fbab89ae7ce..a3f7cff2708e 100644 --- a/packages/snapshot/src/port/utils.ts +++ b/packages/snapshot/src/port/utils.ts @@ -152,7 +152,7 @@ export async function saveSnapshotFile( const content = `${environment.getHeader()}\n\n${snapshots.join('\n\n')}\n` const oldContent = await environment.readSnapshotFile(snapshotPath) - const skipWriting = oldContent && oldContent === content + const skipWriting = oldContent != null && oldContent === content if (skipWriting) return @@ -170,7 +170,7 @@ export async function saveSnapshotFileRaw( snapshotPath: string, ) { const oldContent = await environment.readSnapshotFile(snapshotPath) - const skipWriting = oldContent && oldContent === content + const skipWriting = oldContent != null && oldContent === content if (skipWriting) return