import {readdirSync} from 'node:fs'; import {spawnSync} from 'node:child_process'; import {fileURLToPath} from 'node:url'; import {dirname,join,resolve} from 'node:path'; // Diagnostic-only runner for small sandboxes; never a substitute for the full suite. const root=resolve(dirname(fileURLToPath(import.meta.url)),'..'); const excluded=new Set(['content-removal.test.mjs','node-host.test.mjs','worker.test.mjs']); const files=readdirSync(join(root,'tests')).filter(name=>name.endsWith('.test.mjs')); const included=files.filter(name=>!excluded.has(name)); for(const name of excluded)if(!files.includes(name))throw Error('Missing required full-suite test: '+name); console.error(`CONSTRAINED RUN: ${included.length} files; ${excluded.size} large-bundle files NOT RUN.`); console.error('Excluded: '+[...excluded].join(', ')); console.error('This is NOT a full-suite pass. Run `node --test tests/*.test.mjs` with sufficient memory.'); const result=spawnSync(process.execPath,['--test','--test-concurrency=1',...included.map(name=>join(root,'tests',name))],{cwd:root,stdio:'inherit'}); if(result.error)throw result.error; process.exit(result.status??1);