Skip to content

Commit

Permalink
fix(magic-value): make incrementing magic value a manual step (#641)
Browse files Browse the repository at this point in the history
We should not change the hash used to identify coverage reports unless
an incompatible change is actually introduced. In practice, we should
try to make sure changes are backwards compatible.
  • Loading branch information
bcoe committed Oct 16, 2021
1 parent 6f44023 commit 823010b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/istanbul-lib-instrument/src/constants.js
@@ -1,12 +1,14 @@
const { createHash } = require('crypto');
const { major } = require('semver');
const { name, version } = require('../package.json');
const { name } = require('../package.json');
// TODO: increment this version if there are schema changes
// that are not backwards compatible:
const VERSION = '4';

const SHA = 'sha1';
module.exports = {
SHA,
MAGIC_KEY: '_coverageSchema',
MAGIC_VALUE: createHash(SHA)
.update(name + '@' + major(version))
.update(name + '@' + VERSION)
.digest('hex')
};

0 comments on commit 823010b

Please sign in to comment.