'use strict'; const fs = require('fs'); const path = require('path'); const { spawnSync } = require('child_process'); const { WORKSPACE_ROOT } = require('../mcp/src/core/output-paths'); const tests = [ 'testing/verify-message-archive.js', 'testing/simulate-message-flow.js', 'testing/callback-message-types-smoke.js', ]; const available = tests.filter(relativePath => fs.existsSync(path.join(WORKSPACE_ROOT, relativePath))); if (!available.length) { console.log('[skip] workspace regression tests are not included in the installed npm package'); process.exit(0); } for (const relativePath of available) { const result = spawnSync(process.execPath, [path.join(WORKSPACE_ROOT, relativePath)], { cwd: WORKSPACE_ROOT, encoding: 'utf8', stdio: 'inherit', }); if (result.status !== 0) process.exit(result.status || 1); } console.log(`[ok] workspace regression tests passed (${available.length})`);