xref: /third_party/node/test/addons/non-node-context/test-perf-hooks-timerify.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/addons/non-node-context/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst { runInNewContext } = require(`./build/${common.buildType}/binding`);
61cb0ef41Sopenharmony_ciconst { performance } = require('perf_hooks');
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci// Check that performance.timerify() works when called from another context,
91cb0ef41Sopenharmony_ci// for a function created in another context.
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciconst check = runInNewContext(`
121cb0ef41Sopenharmony_ciconst { performance, assert } = data;
131cb0ef41Sopenharmony_ciconst timerified = performance.timerify(function() { return []; });
141cb0ef41Sopenharmony_ciassert.strictEqual(timerified().constructor, Array);
151cb0ef41Sopenharmony_ci'success';
161cb0ef41Sopenharmony_ci`, { performance, assert });
171cb0ef41Sopenharmony_ciassert.strictEqual(check, 'success');
18

Indexes created Thu Nov 07 10:32:03 CST 2024