Icard/angular-clarity-master(work.../node_modules/piscina/test/pool-destroy.ts

12 lines
365 B
TypeScript
Raw Normal View History

2024-07-16 14:55:36 +00:00
import Piscina from '..';
import { test } from 'tap';
import { resolve } from 'path';
test('can destroy pool while tasks are running', async ({ rejects }) => {
const pool = new Piscina({
filename: resolve(__dirname, 'fixtures/eval.js')
});
setImmediate(() => pool.destroy());
await rejects(pool.runTask('while(1){}'), /Terminating worker thread/);
});