MCPcopy Index your code
hub / github.com/nodejs/node / validateResults

Function validateResults

test/parallel/test-process-threadCpuUsage-worker-threads.js:37–55  ·  view source on GitHub ↗
(results)

Source from the content-addressed store, hash-verified

35}
36
37function validateResults(results) {
38 // This test should have checked that the CPU usage of each thread is greater
39 // than the previous one, while the process one was not.
40 // Unfortunately, the real values are not really predictable on the CI so we
41 // just check that all the values are positive numbers.
42 for (let i = 0; i < 3; i++) {
43 assert.ok(typeof results[i].process.user === 'number');
44 assert.ok(results[i].process.user >= 0);
45
46 assert.ok(typeof results[i].process.system === 'number');
47 assert.ok(results[i].process.system >= 0);
48
49 assert.ok(typeof results[i].thread.user === 'number');
50 assert.ok(results[i].thread.user >= 0);
51
52 assert.ok(typeof results[i].thread.system === 'number');
53 assert.ok(results[i].thread.system >= 0);
54 }
55}
56
57// The main thread will spawn three more threads, then after a while it will ask all of them to
58// report the thread CPU usage and exit.

Calls 1

okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…