1- -- ROBLOX upstream: https://github.com/facebook/react/blob/v17.0.2 /packages/jest-react/src/JestReact.js
1+ -- ROBLOX upstream: https://github.com/facebook/react/blob/v18.2.0 /packages/jest-react/src/JestReact.js
22--[[ *
33 * Copyright (c) Facebook, Inc. and its affiliates.
44 *
55 * This source code is licensed under the MIT license found in the
66 * LICENSE file in the root directory of this source tree.
77 ]]
8+ <<<<<<< HEAD
89local LuauPolyfill = require (" @pkg/@jsdotlua/luau-polyfill" )
910local Array = LuauPolyfill .Array
11+ =======
12+ local Packages --[[ ROBLOX comment: must define Packages module ]]
13+ local LuauPolyfill = require (Packages .LuauPolyfill )
14+ >>>>>>> upstream - apply
1015-- ROBLOX deviation START: not used
1116-- local Boolean = LuauPolyfill.Boolean
1217-- ROBLOX deviation END
18+ local Error = LuauPolyfill .Error
1319local Object = LuauPolyfill .Object
1420local exports = {}
1521-- ROBLOX deviation START: fix import
@@ -23,13 +29,18 @@ local sharedReactSymbolsModule = require("@pkg/@jsdotlua/shared").ReactSymbols
2329-- ROBLOX deviation END
2430local REACT_ELEMENT_TYPE = sharedReactSymbolsModule .REACT_ELEMENT_TYPE
2531local REACT_FRAGMENT_TYPE = sharedReactSymbolsModule .REACT_FRAGMENT_TYPE
32+ <<<<<<< HEAD
2633-- ROBLOX deviation START: fix import
2734-- local invariant = require("@pkg/@jsdotlua/shared").default
2835local invariant = require (" @pkg/@jsdotlua/shared" ).invariant
2936-- ROBLOX deviation END
3037-- ROBLOX deviation START: predeclare variables
3138local jsonChildToJSXChild , jsonChildrenToJSXChildren
3239-- ROBLOX deviation END
40+ =======
41+ local isArray = require (Packages .shared .isArray ).default
42+ exports .act = require (script .Parent .internalAct ).act
43+ >>>>>>> upstream - apply
3344local function captureAssertion (fn )
3445 -- Trick to use a Jest matcher inside another Jest matcher. `fn` contains an
3546 -- assertion; if it throws, we capture the error and return it, so the stack
@@ -75,6 +86,7 @@ local function assertYieldsWereCleared(root)
7586 -- local actualYields = Scheduler:unstable_clearYields()
7687 local actualYields = Scheduler .unstable_clearYields ()
7788 -- ROBLOX deviation END
89+ <<<<<<< HEAD
7890 invariant (
7991 -- ROBLOX deviation START: fix .length
8092 -- actualYields.length == 0,
@@ -83,6 +95,16 @@ local function assertYieldsWereCleared(root)
8395 " Log of yielded values is not empty. "
8496 .. " Call expect(ReactTestRenderer).unstable_toHaveYielded(...) first."
8597 )
98+ =======
99+ if actualYields .length ~= 0 then
100+ error (
101+ Error .new (
102+ " Log of yielded values is not empty. "
103+ .. " Call expect(ReactTestRenderer).unstable_toHaveYielded(...) first."
104+ )
105+ )
106+ end
107+ >>>>>>> upstream - apply
86108end
87109local function unstable_toMatchRenderedOutput (root , expectedJSX )
88110 assertYieldsWereCleared (root )
@@ -93,10 +115,14 @@ local function unstable_toMatchRenderedOutput(root, expectedJSX)
93115 local actualJSX
94116 if actualJSON == nil or typeof (actualJSON ) == " string" then
95117 actualJSX = actualJSON
118+ <<<<<<< HEAD
96119 -- ROBLOX deviation START: remove toJSBoolean
97120 -- elseif Boolean.toJSBoolean(Array.isArray(actualJSON)) then
98121 elseif Array .isArray (actualJSON ) then
99122 -- ROBLOX deviation END
123+ =======
124+ elseif Boolean .toJSBoolean (isArray (actualJSON )) then
125+ >>>>>>> upstream - apply
100126 -- ROBLOX deviation START: fix .length
101127 -- if actualJSON.length == 0 then
102128 if # actualJSON == 0 then
0 commit comments