MCPcopy Create free account
hub / github.com/cypress-io/cypress / validateFile

Function validateFile

scripts/binary/binary-integrity-check-source.js:130–137  ·  view source on GitHub ↗
({ filePath, crypto, fs, expectedHash, errorMessage })

Source from the content-addressed store, hash-verified

128}
129
130function validateFile ({ filePath, crypto, fs, expectedHash, errorMessage }) {
131 const hash = crypto.createHmac('md5', 'HMAC_SECRET').update(fs.readFileSync(filePath, 'utf8')).digest('hex')
132
133 if (hash !== expectedHash) {
134 console.error(errorMessage)
135 throw new Error(integrityErrorMessage)
136 }
137}
138
139// eslint-disable-next-line @typescript-eslint/no-unused-vars -- binary-sources.js embeds this file as text and calls integrityCheck from there
140function integrityCheck (options) {

Callers 1

integrityCheckFunction · 0.85

Calls 2

errorMethod · 0.65
updateMethod · 0.45

Tested by

no test coverage detected