34 lines
1.9 KiB
JavaScript
34 lines
1.9 KiB
JavaScript
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { spawnSync } from 'node:child_process';
|
|
|
|
export const root = fileURLToPath(new URL('../', import.meta.url));
|
|
export const suite = [
|
|
{ directory: 'test-host', mode: 'host' },
|
|
{ directory: 'test-isolation', mode: 'host' },
|
|
{ directory: 'test-self', mode: 'backend', service: '@self' },
|
|
{ directory: 'test-provider' },
|
|
{ directory: 'test-consumer', mode: 'backend', service: 'dev.trove.qa.provider.probe' },
|
|
{ directory: 'test-optional', mode: 'dependency', service: 'dev.trove.qa.absent.probe', expectedError: 'service.not_found' },
|
|
{ directory: 'test-required', mode: 'dependency', service: 'dev.trove.qa.absent.probe', expectedError: 'service.not_found', fault: true },
|
|
{ directory: 'test-incompatible', mode: 'dependency', service: 'dev.trove.qa.provider.probe', expectedError: 'service.version_mismatch', fault: true },
|
|
{ directory: 'test-autostart' },
|
|
{ directory: 'test-crash', mode: 'backend', service: '@self', fault: true },
|
|
{ directory: 'test-start-timeout', mode: 'fault', service: '@self', fault: true },
|
|
{ directory: 'test-bad-handshake', mode: 'fault', service: '@self', fault: true },
|
|
{ directory: 'test-stubborn', mode: 'backend', service: '@self', fault: true },
|
|
{ directory: 'test-upgrade-v1', mode: 'upgrade' },
|
|
{ directory: 'test-upgrade-v2', mode: 'upgrade' },
|
|
];
|
|
|
|
export function run(command, args, options = {}) {
|
|
const result = spawnSync(command, args, { cwd: root, stdio: 'inherit', ...options });
|
|
if (result.error) throw result.error;
|
|
if (result.status !== 0) throw new Error(`${command} exited with ${result.status ?? result.signal}`);
|
|
return result;
|
|
}
|
|
|
|
// Tooling accepts the installed CLI or an explicit build; plugin packages are self-contained.
|
|
export const troveBin = process.env.TROVE_BIN || 'trove';
|
|
export const output = path.join(root, 'dist');
|