mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-05 12:12:05 -07:00
fix: fail Linux packaging when libffmpeg staging is missing
This commit is contained in:
@@ -6,9 +6,11 @@ import test from 'node:test';
|
||||
|
||||
const {
|
||||
LINUX_FFMPEG_LIBRARY,
|
||||
default: afterPack,
|
||||
stageLinuxAppImageSharedLibrary,
|
||||
} = require('./electron-builder-after-pack.cjs') as {
|
||||
LINUX_FFMPEG_LIBRARY: string;
|
||||
default: (context: { appOutDir: string; electronPlatformName: string }) => Promise<void>;
|
||||
stageLinuxAppImageSharedLibrary: (context: {
|
||||
appOutDir: string;
|
||||
electronPlatformName: string;
|
||||
@@ -63,21 +65,39 @@ test('stageLinuxAppImageSharedLibrary skips non-Linux packaging contexts', async
|
||||
}
|
||||
});
|
||||
|
||||
test('stageLinuxAppImageSharedLibrary no-ops when libffmpeg.so is absent', async () => {
|
||||
test('stageLinuxAppImageSharedLibrary throws when Linux packaging is missing libffmpeg.so', async () => {
|
||||
const workspace = createWorkspace('subminer-after-pack-missing-library');
|
||||
const appOutDir = path.join(workspace, 'SubMiner-linux-x64');
|
||||
const targetLibraryPath = path.join(appOutDir, 'usr', 'lib', LINUX_FFMPEG_LIBRARY);
|
||||
|
||||
fs.mkdirSync(appOutDir, { recursive: true });
|
||||
|
||||
try {
|
||||
const staged = await stageLinuxAppImageSharedLibrary({
|
||||
appOutDir,
|
||||
electronPlatformName: 'linux',
|
||||
});
|
||||
|
||||
assert.equal(staged, false);
|
||||
assert.equal(fs.existsSync(targetLibraryPath), false);
|
||||
await assert.rejects(
|
||||
stageLinuxAppImageSharedLibrary({
|
||||
appOutDir,
|
||||
electronPlatformName: 'linux',
|
||||
}),
|
||||
new RegExp(`Linux packaging requires ${LINUX_FFMPEG_LIBRARY} at .*${LINUX_FFMPEG_LIBRARY}`),
|
||||
);
|
||||
} finally {
|
||||
fs.rmSync(workspace, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('afterPack propagates Linux staging failures', async () => {
|
||||
const workspace = createWorkspace('subminer-after-pack-propagates-linux-failure');
|
||||
const appOutDir = path.join(workspace, 'SubMiner-linux-x64');
|
||||
|
||||
fs.mkdirSync(appOutDir, { recursive: true });
|
||||
|
||||
try {
|
||||
await assert.rejects(
|
||||
afterPack({
|
||||
appOutDir,
|
||||
electronPlatformName: 'linux',
|
||||
}),
|
||||
/Linux packaging requires libffmpeg\.so/,
|
||||
);
|
||||
} finally {
|
||||
fs.rmSync(workspace, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user