Files
openhuman/scripts/__tests__/verify-i18n-bundle-args.test.mjs
2026-06-01 17:18:09 -07:00

31 lines
1.0 KiB
JavaScript

import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { test } from 'node:test';
const HERE = dirname(fileURLToPath(import.meta.url));
const SCRIPT = resolve(HERE, '..', 'verify-i18n-bundle.mjs');
function run(args) {
return spawnSync(process.execPath, [SCRIPT, ...args], {
encoding: 'utf8',
});
}
test('verify-i18n-bundle --dist rejects a missing path before filesystem checks', () => {
const result = run(['--dist']);
assert.equal(result.status, 2, result.stderr);
assert.match(result.stderr, /--dist requires a path/);
assert.doesNotMatch(result.stderr, /dist directory does not exist/);
});
test('verify-i18n-bundle --dist rejects another flag as the path value', () => {
const result = run(['--dist', '--help']);
assert.equal(result.status, 2, result.stderr);
assert.match(result.stderr, /--dist requires a path/);
assert.doesNotMatch(result.stderr, /dist directory does not exist/);
});