UNPKG

harmonyc

Version:

Harmony Code - model-driven BDD for Vitest

22 lines (21 loc) 751 B
import { exec, spawn } from 'child_process'; function runCommand(patterns) { return `npx vitest run ${args(patterns)}`; } function runWatchCommand(patterns) { return `npx vitest ${args(patterns)}`; } function args(patterns) { return patterns.map((s) => JSON.stringify(s)).join(' '); } export function run(patterns) { var _a, _b; const cmd = runCommand(patterns); const p = exec(cmd, { cwd: process.cwd() }); (_a = p.stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout); (_b = p.stderr) === null || _b === void 0 ? void 0 : _b.pipe(process.stderr); } export function runWatch(patterns) { const cmd = runWatchCommand(patterns); spawn(cmd, { cwd: process.cwd(), stdio: 'inherit', shell: true }); }