()
| 96 | } |
| 97 | |
| 98 | function runWorkerTest() { |
| 99 | // Use argv to detect whether we're running as a Worker called by this test |
| 100 | // vs. this test also being called as a Worker. |
| 101 | if (process.argv[2] === 'iamalive') { |
| 102 | parentPort.postMessage(JSON.stringify(eventLoopUtilization())); |
| 103 | return; |
| 104 | } |
| 105 | |
| 106 | const elu1 = eventLoopUtilization(); |
| 107 | const worker = new Worker(__filename, { argv: [ 'iamalive' ] }); |
| 108 | |
| 109 | worker.on('message', mustCall((msg) => { |
| 110 | const elu2 = eventLoopUtilization(elu1); |
| 111 | const data = JSON.parse(msg); |
| 112 | |
| 113 | assert.ok(elu2.active + elu2.idle > data.active + data.idle, |
| 114 | `${elu2.active + elu2.idle} <= ${data.active + data.idle}`); |
| 115 | })); |
| 116 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…