mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-21 17:16:20 -07:00
fix(stats): harden server lifecycle and verify compiled runtime (#261)
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
test('compiled runtime smoke fails clearly when build artifacts are missing', () => {
|
||||
const emptyRepo = fs.mkdtempSync(path.join(os.tmpdir(), 'subminer-compiled-missing-'));
|
||||
try {
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
['scripts/compiled-runtime-smoke.mjs', '--repo-root', emptyRepo],
|
||||
{
|
||||
cwd: path.resolve(import.meta.dir, '..'),
|
||||
encoding: 'utf8',
|
||||
},
|
||||
);
|
||||
|
||||
assert.equal(result.status, 1);
|
||||
assert.match(result.stderr, /Compiled runtime artifacts are missing/);
|
||||
assert.match(result.stderr, /dist\/main-entry\.js/);
|
||||
assert.match(result.stderr, /dist\/stats-daemon-runner\.js/);
|
||||
assert.doesNotMatch(result.stderr, /must run with Electron/);
|
||||
} finally {
|
||||
fs.rmSync(emptyRepo, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user