node/test/wpt/test-performance-timeline.js
legendecas a27d245698
perf_hooks: fix performance timeline wpt failures
PR-URL: https://github.com/nodejs/node/pull/39532
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
2021-07-30 07:29:44 -07:00

30 lines
829 B
JavaScript

'use strict';
require('../common');
const { WPTRunner } = require('../common/wpt');
const runner = new WPTRunner('performance-timeline');
// Needed to access to DOMException.
runner.setFlags(['--expose-internals']);
runner.setInitScript(`
const {
PerformanceMark,
PerformanceMeasure,
PerformanceObserver,
PerformanceObserverEntryList,
performance,
} = require('perf_hooks');
global.PerformanceMark = performance;
global.PerformanceMeasure = performance;
global.PerformanceObserver = PerformanceObserver;
global.PerformanceObserverEntryList = PerformanceObserverEntryList;
global.performance = performance;
const { internalBinding } = require('internal/test/binding');
const { DOMException } = internalBinding('messaging');
global.DOMException = DOMException;
`);
runner.runJsTests();