Skip to content

Commit

Permalink
write snapshot file when missing
Browse files Browse the repository at this point in the history
  • Loading branch information
rluvaton committed Jul 26, 2023
1 parent 43af09e commit 39c7dba
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/common/assertSnapshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ async function assertSnapshot(actual, filename = process.argv[1]) {
expected = await fs.readFile(snapshot, 'utf8');
} catch (e) {
if (e.code === 'ENOENT') {
console.log(
'Snapshot file does not exist. You can create a new one by running the test with NODE_REGENERATE_SNAPSHOTS=1',
);
await fs.writeFile(snapshot, actual);
return;
}
throw e;
}
Expand Down

0 comments on commit 39c7dba

Please sign in to comment.