Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(release): format updater manifest test

Steven Enamakelc3269b671054
diff --git a/scripts/__tests__/publish-updater-manifest.test.mjs b/scripts/__tests__/publish-updater-manifest.test.mjs
index 7e4150b4f7..9bb4449411 100644
--- a/scripts/__tests__/publish-updater-manifest.test.mjs
+++ b/scripts/__tests__/publish-updater-manifest.test.mjs
@@ -4,33 +4,45 @@
// (the NSIS setup). Without the `-msi` key an MSI (per-machine) install is
// "updated" by a per-user NSIS setup, leaving the old Program Files copy in
// place, so the app restarts back on the old version.
-import assert from 'node:assert/strict';
-import { spawnSync } from 'node:child_process';
-import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
-import { tmpdir } from 'node:os';
-import { dirname, join, resolve } from 'node:path';
-import { test } from 'node:test';
-import { fileURLToPath } from 'node:url';
+import assert from "node:assert/strict";
+import { spawnSync } from "node:child_process";
+import {
+ chmodSync,
+ mkdtempSync,
+ readFileSync,
+ rmSync,
+ writeFileSync,
+} from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join, resolve } from "node:path";
+import { test } from "node:test";
+import { fileURLToPath } from "node:url";
-const script = resolve(dirname(fileURLToPath(import.meta.url)), '../release/publish-updater-manifest.sh');
+const script = resolve(
+ dirname(fileURLToPath(import.meta.url)),
+ "../release/publish-updater-manifest.sh",
+);
const ASSETS = [
- 'OpenHuman_0.64.1_aarch64.app.tar.gz',
- 'OpenHuman_0.64.1_x64.app.tar.gz',
- 'OpenHuman_0.64.1_amd64.AppImage',
- 'OpenHuman_0.64.1_aarch64.AppImage',
- 'OpenHuman_0.64.1_x64-setup.exe',
- 'OpenHuman_0.64.1_x64_en-US.msi',
+ "OpenHuman_0.64.1_aarch64.app.tar.gz",
+ "OpenHuman_0.64.1_x64.app.tar.gz",
+ "OpenHuman_0.64.1_amd64.AppImage",
+ "OpenHuman_0.64.1_aarch64.AppImage",
+ "OpenHuman_0.64.1_x64-setup.exe",
+ "OpenHuman_0.64.1_x64_en-US.msi",
];
function run(assets) {
- const dir = mkdtempSync(join(tmpdir(), 'updater-manifest-'));
+ const dir = mkdtempSync(join(tmpdir(), "updater-manifest-"));
try {
const sigs = assets.map((a) => `${a}.sig`);
- writeFileSync(join(dir, 'assets.txt'), [...assets, ...sigs].join('\n') + '\n');
+ writeFileSync(
+ join(dir, "assets.txt"),
+ [...assets, ...sigs].join("\n") + "\n",
+ );
// Fake `gh`: lists assets, writes a .sig on download, captures the upload.
writeFileSync(
- join(dir, 'gh'),
+ join(dir, "gh"),
`#!/usr/bin/env bash
case "$1 $2" in
"release view") cat "${dir}/assets.txt" ;;
@@ -39,23 +51,23 @@ case "$1 $2" in
printf 'sig-for-%s\\n' "$pat" > "$out/$pat" ;;
"release upload") cp "$3" "${dir}/uploaded.json" ;;
esac
-`
+`,
);
- chmodSync(join(dir, 'gh'), 0o755);
- const res = spawnSync('bash', [script], {
+ chmodSync(join(dir, "gh"), 0o755);
+ const res = spawnSync("bash", [script], {
env: {
...process.env,
PATH: `${dir}:${process.env.PATH}`,
- TAG: 'v0.64.1',
- VERSION: '0.64.1',
- REPO: 'tinyhumansai/openhuman',
- GITHUB_TOKEN: 'x',
+ TAG: "v0.64.1",
+ VERSION: "0.64.1",
+ REPO: "tinyhumansai/openhuman",
+ GITHUB_TOKEN: "x",
},
- encoding: 'utf8',
+ encoding: "utf8",
});
let manifest = null;
try {
- manifest = JSON.parse(readFileSync(join(dir, 'uploaded.json'), 'utf8'));
+ manifest = JSON.parse(readFileSync(join(dir, "uploaded.json"), "utf8"));
} catch {}
return { res, manifest };
} finally {
@@ -63,16 +75,19 @@ esac
}
}
-test('manifest advertises both NSIS and MSI updater bundles for windows-x86_64', () => {
+test("manifest advertises both NSIS and MSI updater bundles for windows-x86_64", () => {
const { res, manifest } = run(ASSETS);
assert.equal(res.status, 0, res.stderr);
- assert.match(manifest.platforms['windows-x86_64'].url, /x64-setup\.exe$/);
- assert.match(manifest.platforms['windows-x86_64-msi'].url, /x64_en-US\.msi$/);
- assert.match(manifest.platforms['windows-x86_64-msi'].signature, /x64_en-US\.msi\.sig/);
+ assert.match(manifest.platforms["windows-x86_64"].url, /x64-setup\.exe$/);
+ assert.match(manifest.platforms["windows-x86_64-msi"].url, /x64_en-US\.msi$/);
+ assert.match(
+ manifest.platforms["windows-x86_64-msi"].signature,
+ /x64_en-US\.msi\.sig/,
+ );
});
-test('publishing is refused when the MSI updater bundle is missing', () => {
- const { res, manifest } = run(ASSETS.filter((a) => !a.endsWith('.msi')));
+test("publishing is refused when the MSI updater bundle is missing", () => {
+ const { res, manifest } = run(ASSETS.filter((a) => !a.endsWith(".msi")));
assert.notEqual(res.status, 0);
assert.match(res.stderr, /windows-x86_64-msi/);
assert.equal(manifest, null);