ava
ava copied to clipboard
Unhelpful "Could not compare snapshot" error when file is corrupted
https://github.com/avajs/ava/blob/c41b2afc201118bfdc4d2039180ae2ddd0f697c9/lib/assert.js#L318
If I add a console.error('ava error', err) before that line I get:
ava error { [ChecksumError: Checksum mismatch]
name: 'ChecksumError',
snapPath: '/Users/Vaughan/Library/Caches/IntelliJIdea2017.3/wallaby/projects/c682bc127da20367/instrumented/packages/intranav-protocol/test/snapshots/index.test.js.snap' }
This error is not handled and just prints Could not compare snapshot instead without any stack trace.
The checksum error is thrown from here:
https://github.com/avajs/ava/blob/efc3b319628e97c6024bd1f9ab4ace32c827ac57/lib/snapshot-manager.js#L242
The issue causing this circumstance seems to relate more to wallaby.js - https://github.com/wallabyjs/public/issues/1428. But the error should still be displayed by ava.
That error shouldn't really occur in regular circumstances. The snapshot file is binary and it's checksummed. It looks like the file in question has gotten corrupted. Updating snapshots should fix this, though perhaps we should communicate that more clearly.