2017-05-04 17:49:01 +00:00
|
|
|
const assert = require('assert')
|
|
|
|
|
2017-10-27 00:53:47 +00:00
|
|
|
describe('process module', () => {
|
|
|
|
describe('process.getCPUUsage()', () => {
|
|
|
|
it('returns a cpu usage object', () => {
|
2017-05-04 21:15:27 +00:00
|
|
|
const cpuUsage = process.getCPUUsage()
|
2017-05-04 17:49:01 +00:00
|
|
|
assert.equal(typeof cpuUsage.percentCPUUsage, 'number')
|
|
|
|
assert.equal(typeof cpuUsage.idleWakeupsPerSecond, 'number')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2017-10-27 00:53:47 +00:00
|
|
|
describe('process.getIOCounters()', () => {
|
2017-11-15 21:05:46 +00:00
|
|
|
before(function () {
|
|
|
|
if (process.platform === 'darwin') {
|
|
|
|
this.skip()
|
|
|
|
}
|
|
|
|
})
|
2017-10-27 00:53:47 +00:00
|
|
|
|
2017-11-15 21:05:46 +00:00
|
|
|
it('returns an io counters object', () => {
|
2017-05-04 21:15:27 +00:00
|
|
|
const ioCounters = process.getIOCounters()
|
2017-05-04 18:10:57 +00:00
|
|
|
assert.equal(typeof ioCounters.readOperationCount, 'number')
|
|
|
|
assert.equal(typeof ioCounters.writeOperationCount, 'number')
|
|
|
|
assert.equal(typeof ioCounters.otherOperationCount, 'number')
|
|
|
|
assert.equal(typeof ioCounters.readTransferCount, 'number')
|
|
|
|
assert.equal(typeof ioCounters.writeTransferCount, 'number')
|
|
|
|
assert.equal(typeof ioCounters.otherTransferCount, 'number')
|
2017-05-04 17:49:01 +00:00
|
|
|
})
|
|
|
|
})
|
2018-06-10 12:00:36 +00:00
|
|
|
|
|
|
|
describe('process.getHeapStatistics()', () => {
|
|
|
|
it('returns heap statistics object', () => {
|
|
|
|
const heapStats = process.getHeapStatistics()
|
|
|
|
assert.equal(typeof heapStats.totalHeapSize, 'number')
|
|
|
|
assert.equal(typeof heapStats.totalHeapSizeExecutable, 'number')
|
|
|
|
assert.equal(typeof heapStats.totalPhysicalSize, 'number')
|
|
|
|
assert.equal(typeof heapStats.totalAvailableSize, 'number')
|
|
|
|
assert.equal(typeof heapStats.usedHeapSize, 'number')
|
|
|
|
assert.equal(typeof heapStats.heapSizeLimit, 'number')
|
|
|
|
assert.equal(typeof heapStats.mallocedMemory, 'number')
|
|
|
|
assert.equal(typeof heapStats.peakMallocedMemory, 'number')
|
|
|
|
assert.equal(typeof heapStats.doesZapGarbage, 'boolean')
|
|
|
|
})
|
|
|
|
})
|
2017-05-04 17:49:01 +00:00
|
|
|
})
|