NET-Web-API-w-Angular/my-app/node_modules/piscina/test/pool-destroy.ts

12 lines
365 B
TypeScript
Raw Normal View History

2024-02-09 00:38:41 +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/);
});