summaryrefslogtreecommitdiff
path: root/test/addons/non-node-context/test-perf-hooks-timerify.js
blob: 10a9ab8064227eb671701da8902cc75846369304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';

const common = require('../../common');
const assert = require('assert');
const { runInNewContext } = require(`./build/${common.buildType}/binding`);
const { performance } = require('perf_hooks');

// Check that performance.timerify() works when called from another context,
// for a function created in another context.

const check = runInNewContext(`
const { performance, assert } = data;
const timerified = performance.timerify(function() { return []; });
assert.strictEqual(timerified().constructor, Array);
'success';
`, { performance, assert });
assert.strictEqual(check, 'success');