Skip to content

Commit

Permalink
fix(snapshot): improve skipWriting check
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 10, 2023
1 parent 311682a commit 5436c73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/snapshot/src/port/utils.ts
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5436c73

Please sign in to comment.