workspace-regression-smoke-test.js 925 B

1234567891011121314151617181920212223242526272829
  1. 'use strict';
  2. const fs = require('fs');
  3. const path = require('path');
  4. const { spawnSync } = require('child_process');
  5. const { WORKSPACE_ROOT } = require('../mcp/src/core/output-paths');
  6. const tests = [
  7. 'testing/verify-message-archive.js',
  8. 'testing/simulate-message-flow.js',
  9. 'testing/callback-message-types-smoke.js',
  10. ];
  11. const available = tests.filter(relativePath => fs.existsSync(path.join(WORKSPACE_ROOT, relativePath)));
  12. if (!available.length) {
  13. console.log('[skip] workspace regression tests are not included in the installed npm package');
  14. process.exit(0);
  15. }
  16. for (const relativePath of available) {
  17. const result = spawnSync(process.execPath, [path.join(WORKSPACE_ROOT, relativePath)], {
  18. cwd: WORKSPACE_ROOT,
  19. encoding: 'utf8',
  20. stdio: 'inherit',
  21. });
  22. if (result.status !== 0) process.exit(result.status || 1);
  23. }
  24. console.log(`[ok] workspace regression tests passed (${available.length})`);