assistant/scripts/test-migrate-learning.mjs

13 lines
671 B
JavaScript

import { spawn } from 'node:child_process';
import { pythonPath, root } from './server.mjs';
// Loading .env above is permitted, but only the dedicated TEST DSN reaches the
// test. The test replaces the migration's target with that DSN + a random schema.
const child = spawn(pythonPath(), ['-m', 'scripts.test_migrate_learning'], {
cwd: root,
env: { ...process.env, PYTHONUTF8: '1', ASSISTANT_DATABASE_URL: '', ASSISTANT_DATABASE_SCHEMA: '' },
stdio: 'inherit', windowsHide: true,
});
child.on('error', () => { console.error('Unable to launch the isolated migration tests.'); process.exitCode = 1; });
child.on('exit', code => { process.exitCode = code || 0; });