Prettier had never been run in --check mode here before, so this had drifted across most files (markdown tables, long option() chains, line wrapping). Purely formatting, no logic changes - needed so a CI format:check gate can actually pass. Adds .prettierignore for pnpm-lock.yaml specifically: prettier's YAML formatter rewrites every quoted key (single -> double quotes) producing an ~8700-line diff of pure noise on a file pnpm itself owns the formatting of. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import { renderUnit } from "./systemd";
|
|
|
|
test("renderUnit builds an absolute-path ExecStart with the given args", () => {
|
|
const unit = renderUnit({
|
|
execPath: "/usr/bin/node",
|
|
binPath:
|
|
"/home/user/.local/share/pnpm/global/5/node_modules/.bin/triggershell",
|
|
configPath: "/home/user/project/triggershell.yml",
|
|
configDir: "/home/user/project",
|
|
port: 8080,
|
|
host: "0.0.0.0",
|
|
scope: "user",
|
|
});
|
|
|
|
assert.match(
|
|
unit,
|
|
/ExecStart=\/usr\/bin\/node .*triggershell start --config \/home\/user\/project\/triggershell\.yml --no-browser --port 8080 --host 0\.0\.0\.0/,
|
|
);
|
|
assert.match(unit, /WorkingDirectory=\/home\/user\/project/);
|
|
assert.match(unit, /WantedBy=default\.target/);
|
|
});
|
|
|
|
test("renderUnit uses multi-user.target for the system scope", () => {
|
|
const unit = renderUnit({
|
|
execPath: "/usr/bin/node",
|
|
binPath: "/usr/lib/node_modules/triggershell/bin/triggershell.js",
|
|
configPath: "/etc/triggershell/triggershell.yml",
|
|
configDir: "/etc/triggershell",
|
|
scope: "system",
|
|
});
|
|
|
|
assert.match(unit, /WantedBy=multi-user\.target/);
|
|
assert.match(
|
|
unit,
|
|
/ExecStart=\/usr\/bin\/node .*start --config .*--no-browser$/m,
|
|
);
|
|
});
|