Two Electron applications built from the identical electron binary set package the same ELF build-id links under /usr/lib/.build-id, so installing musrflow next to trimsp failed the transaction test. Pass _build_id_links none to rpmbuild via fpm so the rpm no longer claims those paths.
41 lines
2.2 KiB
JavaScript
41 lines
2.2 KiB
JavaScript
// Copyright (C) 2026 Zaher Salman
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
const lock = JSON.parse(fs.readFileSync(path.join(root, 'package-lock.json'), 'utf8'));
|
|
const main = fs.readFileSync(path.join(root, 'main.js'), 'utf8');
|
|
|
|
assert.strictEqual(pkg.version, '1.0.0-rc.4');
|
|
assert.strictEqual(lock.version, pkg.version);
|
|
assert.strictEqual(lock.packages[''].version, pkg.version);
|
|
assert.strictEqual(pkg.build.appId, 'ch.psi.lmu.musrflow');
|
|
assert(pkg.build.linux.target.includes('rpm'));
|
|
assert(pkg.build.linux.target.includes('AppImage'));
|
|
assert.strictEqual(pkg.build.rpm.artifactName, '${name}-${version}-${arch}.${ext}');
|
|
assert(!pkg.build.rpm.artifactName.includes('${productName}'), 'RPM artifact name must be lower case');
|
|
assert(pkg.build.rpm.fpm.some(function(arg) { return arg === '--rpm-rpmbuild-define=_build_id_links none'; }), 'RPM must not package build-id links');
|
|
assert(pkg.scripts['dist:rpm'].includes('electron-builder@26.15.3'));
|
|
assert(pkg.scripts['dist:appimage'].includes('electron-builder@26.15.3'));
|
|
assert(pkg.scripts['checksums:md5'].includes('md5sum'));
|
|
assert(pkg.scripts['checksums:sha256'].includes('sha256sum'));
|
|
assert.strictEqual(pkg.scripts.checksums, 'npm run checksums:md5 && npm run checksums:sha256');
|
|
assert(main.includes('app.getVersion()'), 'About dialog should report the package version');
|
|
assert(main.includes('Author: Zaher Salman'), 'About dialog should report the author');
|
|
assert(main.includes('Copyright (C) 2026 Zaher Salman'), 'About dialog should report copyright');
|
|
assert.strictEqual(pkg.build.linux.icon, 'assets/musrflow-icon.png');
|
|
assert(pkg.build.files.includes('assets/**/*'));
|
|
assert(fs.existsSync(path.join(root, 'assets', 'musrflow-icon.png')));
|
|
assert(fs.existsSync(path.join(root, 'assets', 'musrflow-favicon.png')));
|
|
|
|
for (const file of pkg.build.files) {
|
|
if (file.includes('*') || file === 'package.json') continue;
|
|
assert(fs.existsSync(path.join(root, file)), `packaged file is missing: ${file}`);
|
|
}
|
|
|
|
console.log('release packaging tests passed');
|