import assert from 'node:assert/strict'; import { runIsolated } from './isolation.js'; // Shared offscreen Quickshell launch in isolation.js: software rendering, private // HOME, XDG and runtime directories under `directory`, no host display, compositor, // portal, or accessibility bus. `bus: true` gives a private session bus, also // standing in as the system bus, that activates nothing. Load evidence, not pixels. export function runOffscreen(entry, { directory, timeout = 10_000, env = {}, cwd, bus = false } = {}) { assert(directory, 'offscreen runs need a private directory'); const run = runIsolated('qs', ['--no-color', '-p', entry], { directory, env, cwd, bus, encoding: 'utf8', timeout }); return { ...run, output: String(run.stdout || '') + String(run.stderr || '') }; } // Quickshell logs Qt warnings, including binding loops, at WARN. export const offscreenDiagnostic = /WARN|ERROR|Error:|TypeError|ReferenceError/; // Exit 0, no diagnostic anywhere in the complete output, and the fixture's own pass marker. export function assertOffscreenPass(run, marker, detail = '') { assert.ifError(run.error); assert.equal(run.status, 0, run.output + detail); assert.doesNotMatch(run.output, offscreenDiagnostic, run.output + detail); assert.match(run.output, marker, run.output + detail); }