Make the checks pass on a fresh clone

- build.rs creates the empty browser-engine folder that tauri-build
  requires, so cargo test runs before the browser runtime is staged.
- The Table Formulas tests skip with a reason when the package is not
  built. Before, the missing module failed two whole test files.
- The installer test accepts CRLF checkouts and skips with a reason
  when the NSIS compiler is missing.
- hostTodo.spec.mjs never ran because of its extension. Its two valid
  background tests move to appearance.spec.ts with current defaults.
  The third test repeated an existing export test.
- Remove tsconfig.plugins.json. It checked the plugins/ folder, which
  moved to separate repositories in 0.1.7.
This commit is contained in:
Knotty Wyvern
2026-10-27 19:41:08 -07:00
parent 2d2a146e34
commit 90d1940c73
8 changed files with 50 additions and 53 deletions
+8 -3
View File
@@ -4,6 +4,7 @@ import { mkdtemp, readFile, writeFile, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { spawnSync } from 'node:child_process';
import { existsSync } from 'node:fs';
import { releaseVersion, nextHotfix, compareReleases } from './releaseVersion.mjs';
const ordering = ['0.1.22z', '0.1.23', '0.1.23a', '0.1.23b', '0.1.23c', '0.1.23z', '0.1.23aa', '0.1.23ab', '0.1.23zz', '0.1.23aaa', '0.1.24'];
@@ -15,7 +16,10 @@ test('hotfix versions retain their release identity and advance in letter order'
for (let i = 0; i < ordering.length; i++) for (let j = 0; j < ordering.length; j++) assert.equal(compareReleases(ordering[i], ordering[j]), Math.sign(i - j));
});
test('the native NSIS comparator blocks older hotfixes and permits reinstall', { skip: process.platform !== 'win32' }, async () => {
const makensis = path.join(process.env.LOCALAPPDATA ?? '', 'tauri/NSIS/makensis.exe');
const nsisSkip = process.platform !== 'win32' ? 'Windows only' : existsSync(makensis) ? false : 'the NSIS compiler is missing; run pnpm build:installer once to download it';
test('the native NSIS comparator blocks older hotfixes and permits reinstall', { skip: nsisSkip }, async () => {
const root = await mkdtemp(path.join(tmpdir(), 'runestone-installer-version-'));
try {
const checks: string[] = [];
@@ -31,7 +35,7 @@ test('the native NSIS comparator blocks older hotfixes and permits reinstall', {
const source = `Unicode true\nSilentInstall silent\nRequestExecutionLevel user\nName "RuneStone version check"\nOutFile "${executable}"\n!include LogicLib.nsh\n!include WordFunc.nsh\n!include "${path.resolve('src-tauri/windows/versionCompare.nsh')}"\nSection\n${checks.join('\n')}\nSetErrorLevel 0\nSectionEnd\n`;
const script = path.join(root, 'compare.nsi');
await writeFile(script, source);
const compiler = path.join(process.env.LOCALAPPDATA!, 'tauri/NSIS/makensis.exe');
const compiler = makensis;
const built = spawnSync(compiler, ['/V2', script], { encoding: 'utf8', windowsHide: true });
assert.equal(built.status, 0, built.stdout + built.stderr);
const checked = spawnSync(executable, ['/S'], { encoding: 'utf8', windowsHide: true, timeout: 30000 });
@@ -39,7 +43,8 @@ test('the native NSIS comparator blocks older hotfixes and permits reinstall', {
const patched = spawnSync('powershell.exe', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', path.resolve('scripts/setWindowsVersion.ps1'), '-Path', executable, '-Version', '0.1.23a', '-NumericVersion', '0.1.23.1'], { encoding: 'utf8', windowsHide: true });
assert.equal(patched.status, 0, patched.stdout + patched.stderr);
assert.match(patched.stdout, /0\.1\.23a/);
const template = await readFile('src-tauri/windows/installer.nsi', 'utf8');
// Git can check the template out with CRLF line endings on Windows.
const template = (await readFile('src-tauri/windows/installer.nsi', 'utf8')).replaceAll('\r\n', '\n');
assert.ok(template.includes('Call RuneStoneCompareVersions'));
assert.ok(!template.includes('nsis_tauri_utils::SemverCompare'));
assert.match(template, /SetErrorLevel 2\n\s+Quit/);