n8n/packages/workflow/test/setup-vm-evaluator.ts
Iván Ovejero f8c21276cb
feat(core): Make VM expression bridge timeout and memory limit configurable (#27962)
Co-authored-by: Danny Martini <danny@n8n.io>
2026-04-08 16:07:16 +00:00

21 lines
516 B
TypeScript

import { Expression } from '../src/expression';
// Only runs when N8N_EXPRESSION_ENGINE=vm is set.
// Initializes the VM evaluator once per vitest worker before all tests,
// and disposes it after.
if (process.env.N8N_EXPRESSION_ENGINE === 'vm') {
beforeAll(async () => {
await Expression.initExpressionEngine({
engine: 'vm',
poolSize: 1,
maxCodeCacheSize: 1024,
bridgeTimeout: 5000,
bridgeMemoryLimit: 128,
});
});
afterAll(async () => {
await Expression.disposeExpressionEngine();
});
}