source: trip-planner-front/node_modules/piscina/test/histogram.ts@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 908 bytes
Line 
1import Piscina from '..';
2import { test } from 'tap';
3import { resolve } from 'path';
4
5test('pool will maintain run and wait time histograms', async ({ equal, ok }) => {
6 const pool = new Piscina({
7 filename: resolve(__dirname, 'fixtures/eval.js')
8 });
9
10 const tasks = [];
11 for (let n = 0; n < 10; n++) {
12 tasks.push(pool.runTask('42'));
13 }
14 await Promise.all(tasks);
15
16 const waitTime = pool.waitTime as any;
17 ok(waitTime);
18 equal(typeof waitTime.average, 'number');
19 equal(typeof waitTime.mean, 'number');
20 equal(typeof waitTime.stddev, 'number');
21 equal(typeof waitTime.min, 'number');
22 equal(typeof waitTime.max, 'number');
23
24 const runTime = pool.runTime as any;
25 ok(runTime);
26 equal(typeof runTime.average, 'number');
27 equal(typeof runTime.mean, 'number');
28 equal(typeof runTime.stddev, 'number');
29 equal(typeof runTime.min, 'number');
30 equal(typeof runTime.max, 'number');
31});
Note: See TracBrowser for help on using the repository browser.