pool-destroy.ts 365 B

1234567891011
  1. import Piscina from '..';
  2. import { test } from 'tap';
  3. import { resolve } from 'path';
  4. test('can destroy pool while tasks are running', async ({ rejects }) => {
  5. const pool = new Piscina({
  6. filename: resolve(__dirname, 'fixtures/eval.js')
  7. });
  8. setImmediate(() => pool.destroy());
  9. await rejects(pool.runTask('while(1){}'), /Terminating worker thread/);
  10. });