diff --git a/jest/integration/runtime/setup.js b/jest/integration/runtime/setup.js index 36bee8346f0..9dda572b621 100644 --- a/jest/integration/runtime/setup.js +++ b/jest/integration/runtime/setup.js @@ -248,9 +248,12 @@ function reportTestSuiteResult(testSuiteResult: TestSuiteResult): void { console.log(JSON.stringify(testSuiteResult)); } +global.$$RunTests$$ = () => { + executeTests(); +}; + export function registerTest(setUpTest: () => void) { runWithGuard(() => { setUpTest(); - executeTests(); }); } diff --git a/packages/react-native/src/private/__tests__/ReactNativeTester.js b/packages/react-native/src/private/__tests__/ReactNativeTester.js deleted file mode 100644 index 121f057f3fb..00000000000 --- a/packages/react-native/src/private/__tests__/ReactNativeTester.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -import type {MixedElement} from 'react'; - -import ReactFabric from '../../../Libraries/Renderer/shims/ReactFabric'; - -let globalSurfaceIdCounter = 1; - -class Root { - #surfaceId: number; - #hasRendered: boolean = false; - - constructor() { - this.#surfaceId = globalSurfaceIdCounter; - globalSurfaceIdCounter += 10; - } - - render(element: MixedElement) { - if (!this.#hasRendered) { - global.$$JSTesterModuleName$$.startSurface(this.#surfaceId); - this.#hasRendered = true; - } - ReactFabric.render(element, this.#surfaceId); - } - - destroy() { - // TODO: check for leaks. - global.$$JSTesterModuleName$$.stopSurface(this.#surfaceId); - } - - // TODO: add an API to check if all surfaces were deallocated when tests are finished. -} - -// TODO: Add option to define surface props and pass it to startSurface -// Surfacep rops: concurrentRoot, surfaceWidth, surfaceHeight, layoutDirection, pointScaleFactor. -export function createRoot(): Root { - return new Root(); -}