mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-06-21 21:50:30 -04:00
checkPlugin: Compare entire file
This commit is contained in:
parent
f0669a8d31
commit
51c530a3a0
3 changed files with 1 additions and 10 deletions
|
@ -107,16 +107,13 @@ const prepareRepo = () => {
|
|||
|
||||
const checkFile = (srcFn, dstFn) => {
|
||||
const outFn = path.join(pluginPath, dstFn);
|
||||
const verRegEx = /^##ETHERPAD_NPM_V=(\d+)$/;
|
||||
const wantContents = fs.readFileSync(srcFn, {encoding: 'utf8'});
|
||||
const [, wantVer] = verRegEx.exec(wantContents) || [];
|
||||
let gotContents = null;
|
||||
try {
|
||||
gotContents = fs.readFileSync(outFn, {encoding: 'utf8'});
|
||||
} catch (err) { /* treat as if the file doesn't exist */ }
|
||||
const [, gotVer] = verRegEx.exec(gotContents || '') || [];
|
||||
try {
|
||||
assert.equal(gotVer, wantVer);
|
||||
assert.equal(gotContents, wantContents);
|
||||
} catch (err) {
|
||||
console.warn(`File ${dstFn} is out of date`);
|
||||
console.warn(err.message);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue