puleos / object-hash

Generate hashes from javascript objects in node and the browser.
MIT License
1.41k stars 145 forks source link

Snapshot tests #115

Closed ArtiomTr closed 9 months ago

ArtiomTr commented 2 years ago

Jest provides awesome feature - snapshot testing. These tests can help automate versioning - according to the documentation, changes that affect hash values are considered semver-major. So theoretically, with these tests, some pipeline could automatically bump version when any of snapshot files change.

However, according to the jest's package.json file, it supports only node versions 12.x, 14.x, 16.x and >= 17.x. So this means that these additional checks require either dropping support of older node versions, or having two different testing frameworks - mocha (current) and jest (for snapshots).

If you decide to add them, I could open a PR.

jonkoops commented 9 months ago

I don't see a good reason to introduce snapshot testing here. This library takes a set of inputs and expects an output of a given value, this is already perfectly covered by the unit tests, so adding snapshots would not really be of value.