import { createRequire } from 'node:module' import { spawnSync } from 'node:child_process' import { fileURLToPath } from 'node:url' import { dirname, resolve } from 'node:path' const require = createRequire(import.meta.url) const executable = require('electron') const root = fileURLToPath(new URL('../', import.meta.url)) // Native SQLite is built for Electron. Test it in Electron's Node runtime rather than rebuilding twice. const cli = resolve( dirname(require.resolve('vitest/package.json')), require('vitest/package.json').bin.vitest ) const result = spawnSync(executable, [cli, 'run', '--config', 'vitest.native.config.ts'], { cwd: root, env: { ...process.env, ELECTRON_RUN_AS_NODE: '1' }, stdio: 'inherit', windowsHide: true }) if (result.error) console.error(result.error.message) process.exitCode = result.status ?? 1