mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
93f0b4d35b
Added toJSON method to the InternalPerformance class as per the convention followed in other performance classes and per the spec: https://www.w3.org/TR/hr-time/#tojson-method Fixes: https://github.com/nodejs/node/issues/37623 PR-URL: https://github.com/nodejs/node/pull/37771 Fixes: https://github.com/nodejs/node/issues/37623 Reviewed-By: James M Snell <jasnell@gmail.com>
15 lines
447 B
JavaScript
15 lines
447 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const { performance } = require('perf_hooks');
|
|
|
|
// Test toJSON for performance object
|
|
{
|
|
assert.strictEqual(typeof performance.toJSON, 'function');
|
|
const jsonObject = performance.toJSON();
|
|
assert.strictEqual(typeof jsonObject, 'object');
|
|
assert.strictEqual(jsonObject.timeOrigin, performance.timeOrigin);
|
|
assert.strictEqual(typeof jsonObject.nodeTiming, 'object');
|
|
}
|