43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
import { spawn } from 'node:child_process';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
const vitestPath = path.join(packageRoot, 'node_modules', 'vitest', 'vitest.mjs');
|
|
|
|
const child = spawn(
|
|
process.execPath,
|
|
[
|
|
'--expose-gc',
|
|
vitestPath,
|
|
'run',
|
|
'--config',
|
|
'vitest.config.ts',
|
|
'--pool=threads',
|
|
'--maxWorkers=1',
|
|
'test/npcNationUprisingUnification.test.ts',
|
|
],
|
|
{
|
|
cwd: packageRoot,
|
|
env: {
|
|
...process.env,
|
|
NPC_UNIFICATION_MEMORY_PROFILE: '1',
|
|
},
|
|
stdio: 'inherit',
|
|
}
|
|
);
|
|
|
|
child.once('error', (error) => {
|
|
console.error('[npc-unification-memory] failed to start profiler', error);
|
|
process.exitCode = 1;
|
|
});
|
|
|
|
child.once('exit', (code, signal) => {
|
|
if (signal) {
|
|
console.error(`[npc-unification-memory] profiler terminated by ${signal}`);
|
|
process.exitCode = 1;
|
|
return;
|
|
}
|
|
process.exitCode = code ?? 1;
|
|
});
|