diff --git a/packages/react-native/src/private/webapis/performance/__tests__/EventTimingAPI-itest.js b/packages/react-native/src/private/webapis/performance/__tests__/EventTimingAPI-itest.js index 5c46106f95d..886a5da8481 100644 --- a/packages/react-native/src/private/webapis/performance/__tests__/EventTimingAPI-itest.js +++ b/packages/react-native/src/private/webapis/performance/__tests__/EventTimingAPI-itest.js @@ -10,24 +10,17 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import type Performance from 'react-native/src/private/webapis/performance/Performance'; -import type {PerformanceObserverEntryList} from 'react-native/src/private/webapis/performance/PerformanceObserver'; - import MaybeNativePerformance from '../specs/NativePerformance'; import * as Fantom from '@react-native/fantom'; import nullthrows from 'nullthrows'; import {useState} from 'react'; import {Text, View} from 'react-native'; import setUpPerformanceObserver from 'react-native/src/private/setup/setUpPerformanceObserver'; -import {PerformanceEventTiming} from 'react-native/src/private/webapis/performance/EventTiming'; -import {PerformanceObserver} from 'react-native/src/private/webapis/performance/PerformanceObserver'; const NativePerformance = nullthrows(MaybeNativePerformance); setUpPerformanceObserver(); -declare var performance: Performance; - function sleep(ms: number) { const end = performance.now() + ms; while (performance.now() < end) {} diff --git a/packages/react-native/src/private/webapis/performance/__tests__/LongTasksAPI-itest.js b/packages/react-native/src/private/webapis/performance/__tests__/LongTasksAPI-itest.js index 80ff9cf54f0..990663ff03b 100644 --- a/packages/react-native/src/private/webapis/performance/__tests__/LongTasksAPI-itest.js +++ b/packages/react-native/src/private/webapis/performance/__tests__/LongTasksAPI-itest.js @@ -10,15 +10,10 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import type { - PerformanceObserverCallbackOptions, - PerformanceObserverEntryList, -} from 'react-native/src/private/webapis/performance/PerformanceObserver'; +import type {PerformanceObserverCallbackOptions} from '../PerformanceObserver'; import * as Fantom from '@react-native/fantom'; import setUpPerformanceObserver from 'react-native/src/private/setup/setUpPerformanceObserver'; -import {PerformanceLongTaskTiming} from 'react-native/src/private/webapis/performance/LongTasks'; -import {PerformanceObserver} from 'react-native/src/private/webapis/performance/PerformanceObserver'; setUpPerformanceObserver(); diff --git a/packages/react-native/src/private/webapis/performance/__tests__/Performance-benchmark-itest.js b/packages/react-native/src/private/webapis/performance/__tests__/Performance-benchmark-itest.js index d69768d8d71..2829b8f94cf 100644 --- a/packages/react-native/src/private/webapis/performance/__tests__/Performance-benchmark-itest.js +++ b/packages/react-native/src/private/webapis/performance/__tests__/Performance-benchmark-itest.js @@ -10,12 +10,8 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import type Performance from 'react-native/src/private/webapis/performance/Performance'; - import * as Fantom from '@react-native/fantom'; -declare var performance: Performance; - const clearMarksAndMeasures = () => { performance.clearMarks(); performance.clearMeasures(); diff --git a/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js b/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js index c3c65486e34..77af8cb8c83 100644 --- a/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js +++ b/packages/react-native/src/private/webapis/performance/__tests__/PerformanceObserver-itest.js @@ -10,20 +10,11 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import type Performance from '../Performance'; -import type { - PerformanceObserver as PerformanceObserverT, - PerformanceObserverEntryList, -} from '../PerformanceObserver'; - import setUpPerformanceObserver from '../../../setup/setUpPerformanceObserver'; import * as Fantom from '@react-native/fantom'; setUpPerformanceObserver(); -declare var performance: Performance; -declare var PerformanceObserver: Class; - describe('PerformanceObserver', () => { it('receives notifications for marks and measures', () => { const callback = jest.fn(); diff --git a/packages/react-native/src/private/webapis/performance/__tests__/UserTiming-itest.js b/packages/react-native/src/private/webapis/performance/__tests__/UserTiming-itest.js index 0bc20e7c012..00714de389f 100644 --- a/packages/react-native/src/private/webapis/performance/__tests__/UserTiming-itest.js +++ b/packages/react-native/src/private/webapis/performance/__tests__/UserTiming-itest.js @@ -10,18 +10,12 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; -import type Performance from '../Performance'; -import type { - PerformanceEntryJSON, - PerformanceEntryList, -} from '../PerformanceEntry'; - import ensureInstance from '../../../__tests__/utilities/ensureInstance'; +import setUpPerformanceObserver from '../../../setup/setUpPerformanceObserver'; import DOMException from '../../errors/DOMException'; -import {PerformanceMark, PerformanceMeasure} from '../UserTiming'; import * as Fantom from '@react-native/fantom'; -declare var performance: Performance; +setUpPerformanceObserver(); function getThrownError(fn: () => mixed): mixed { try { @@ -32,7 +26,7 @@ function getThrownError(fn: () => mixed): mixed { throw new Error('Expected function to throw'); } -function toJSON(entries: PerformanceEntryList): Array { +function toJSON(entries: PerformanceEntryList): Array { return entries.map(entry => entry.toJSON()); }