Skip to content

Commit 39c7dba

Browse files
committed
write snapshot file when missing
1 parent 43af09e commit 39c7dba

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

test/common/assertSnapshot.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ async function assertSnapshot(actual, filename = process.argv[1]) {
3939
expected = await fs.readFile(snapshot, 'utf8');
4040
} catch (e) {
4141
if (e.code === 'ENOENT') {
42-
console.log(
43-
'Snapshot file does not exist. You can create a new one by running the test with NODE_REGENERATE_SNAPSHOTS=1',
44-
);
42+
await fs.writeFile(snapshot, actual);
43+
return;
4544
}
4645
throw e;
4746
}

0 commit comments

Comments
 (0)