const fs = require('node:fs'); const path = require('node:path'); const { spawnSync } = require('node:child_process'); const root = path.resolve(__dirname, '..'); const files = fs.readdirSync(path.join(root, 'tests')).filter((name) => name.endsWith('.test.cjs')).sort().map((name) => path.join(root, 'tests', name)); const result = spawnSync(process.execPath, ['--test', '--test-concurrency=1', ...files], { cwd: root, stdio: 'inherit' }); if (result.error) throw result.error; process.exitCode = result.status ?? 1;