Files
VoiceStudio/scripts/electron-smoke-test.mjs
T
Palash Debnath 2213092a01 ci: make Electron the only active desktop target (#2220)
Make Electron the maintained desktop target, preserve frozen Tauri v0.5.3 updater feeds, and align setup, smoke checks, release policy and documentation. Validated by full CI, cross-platform smoke and install tests, security checks, and bot review.
2026-09-20 08:26:57 +05:30

37 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
import { spawnSync } from 'node:child_process';
import process from 'node:process';
function run(command, args) {
console.log(`\n> ${command} ${args.join(' ')}`);
const result = spawnSync(command, args, {
cwd: process.cwd(),
env: process.env,
stdio: 'inherit',
});
if (result.error) throw result.error;
if (result.status !== 0) process.exit(result.status ?? 1);
}
const args = process.argv.slice(2);
if (!args.includes('--skip-build')) {
run('bun', ['run', '--cwd', 'electron', 'dist:dir']);
}
const testArgs = args.filter((arg) => arg !== '--skip-build');
const smoke = ['electron/tests/packaged-smoke.mjs', ...(testArgs.length ? testArgs : ['--setup'])];
const headlessLinux =
process.platform === 'linux' && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY;
if (headlessLinux) {
const probe = spawnSync('xvfb-run', ['--help'], { stdio: 'ignore' });
if (probe.error) {
console.error('A display is required. Install xvfb or run this command from a desktop session.');
process.exit(1);
}
run('xvfb-run', ['-a', 'node', ...smoke]);
} else {
run('node', smoke);
}