Files
openless/openless-all/app/scripts/frontend-test-runner.test.mjs
T
cd48a037a4 fix(less-computer): restore OpenCode model discovery and execution (#840)
* fix(less-computer): restore OpenCode model execution

* fix(capsule): gate set_ignore_cursor_events behind #[cfg(not(mobile))]

#887 introduced desktop-only capsule cursor-passthrough logic into the
unconditionally-compiled capsule_focus module, breaking Android cargo check
(E0599: no method set_ignore_cursor_events on tauri::WebviewWindow). Gate the
block to desktop; variables it consumes (classic_style, selection_polish,
visible) are still used on mobile outside the block.

---------

Co-authored-by: sim <sim@local>
Co-authored-by: Chris233 <h-chris233@outlook.com>
2026-08-03 16:03:41 +08:00

54 lines
1.9 KiB
JavaScript

import assert from 'node:assert/strict';
import { resolve } from 'node:path';
import process from 'node:process';
import { discoverTestFiles, runTestFiles } from './frontend-test-runner.mjs';
const discovered = discoverTestFiles();
for (const expected of [
'scripts/check-android-updater-pubkey.mjs',
'scripts/check-hotkey-injection.mjs',
'scripts/less-computer-opencode-contract.test.mjs',
'scripts/macos-capsule-spaces-contract.test.mjs',
'scripts/macos-speech-usage-description-contract.test.mjs',
'scripts/repository-owner-contract.test.mjs',
'scripts/windows-ui-config.test.mjs',
'src/lib/hotkeyRecorder.test.ts',
'src/lib/windowHotkeyFallback.test.ts',
]) {
assert(discovered.includes(expected), `aggregate discovery omitted ${expected}`);
}
assert.equal(new Set(discovered).size, discovered.length, 'aggregate discovery must not duplicate tests');
const invocations = [];
const statuses = [0, 7, 0];
const exitCode = runTestFiles(
[
'src/lib/passes.test.ts',
'scripts/fails.test.mjs',
'scripts/must-not-run.test.mjs',
],
{
appRoot: '/app',
log: () => {},
spawn(command, args, options) {
invocations.push({ command, args, options });
return { status: statuses[invocations.length - 1] };
},
tsxCli: '/tools/tsx-cli.mjs',
},
);
assert.equal(exitCode, 7, 'the aggregate runner must propagate a failing child status');
assert.equal(invocations.length, 2, 'the aggregate runner must stop after the first failure');
assert.deepEqual(invocations[0].args, [
'/tools/tsx-cli.mjs',
resolve('/app', 'src/lib/passes.test.ts'),
]);
assert.deepEqual(invocations[1].args, [resolve('/app', 'scripts/fails.test.mjs')]);
assert.equal(invocations[0].command, process.execPath);
assert.equal(invocations[1].command, process.execPath);
assert.equal(invocations[0].options.stdio, 'inherit');
console.log('frontend-test-runner.test.mjs passed');