// Synthetic signatures/files only. Deliberately discard configured DB URLs, // environment preload hooks and application secrets, including during SQL suites. import { spawn } from 'node:child_process' import { createRequire } from 'node:module' import { fileURLToPath, pathToFileURL } from 'node:url' if (process.argv.length !== 2) throw Error('Source-binding synthetic runner takes no arguments') const require = createRequire(import.meta.url) const env = Object.fromEntries(['SystemRoot', 'WINDIR', 'TEMP', 'TMP', 'LANG', 'LC_ALL'] .filter(key => typeof process.env[key] === 'string').map(key => [key, process.env[key]])) const child = spawn(process.execPath, ['--import', pathToFileURL(require.resolve('tsx')).href, '--test', fileURLToPath(new URL('../src/db/database-source-binding.test.ts', import.meta.url))], { cwd: new URL('../', import.meta.url), env: { ...env, MMAPP_OWN_SOURCE_BINDING_SYNTHETIC: 'true' }, windowsHide: true, stdio: 'inherit', }) child.once('error', () => { console.error('Source-binding synthetic child could not start'); process.exitCode = 1 }) child.once('exit', code => { process.exitCode = code ?? 1 })