@samitouri / QOS-React-1 / commits / 374fd68a50

fix: define IS_ACT_ENVIRONMENT global for tests with concurrent mode and synchronous act (#28296)

Ruslan Lesiutin committed Feb 9, 2024 at 19:03 UTC 374fd68a50f00237555cdeb60ad01cba171328f9
5 files changed +10 -6
packages/react-devtools-shared/src/__tests__/FastRefreshDevToolsIntegration-test.js
+2
@@ -20,6 +20,8 @@ describe('Fast Refresh', () => {
20 let withErrorsOrWarningsIgnored;
21
22 beforeEach(() => {
23 + global.IS_REACT_ACT_ENVIRONMENT = true;
24 +
25 exportsObj = undefined;
26
27 babel = require('@babel/core');
packages/react-devtools-shared/src/__tests__/profilerStore-test.js
+2
@@ -17,6 +17,8 @@ describe('ProfilerStore', () => {
17 let utils;
18
19 beforeEach(() => {
20 + global.IS_REACT_ACT_ENVIRONMENT = true;
21 +
22 utils = require('./utils');
23 utils.beforeEachProfiling();
24
packages/react-devtools-shared/src/__tests__/store-test.js
+2
@@ -23,6 +23,8 @@ describe('Store', () => {
23 let withErrorsOrWarningsIgnored;
24
25 beforeEach(() => {
26 + global.IS_REACT_ACT_ENVIRONMENT = true;
27 +
28 agent = global.agent;
29 bridge = global.bridge;
30 store = global.store;
packages/react-devtools-shared/src/__tests__/storeStressTestConcurrent-test.js
+2 -6
@@ -17,6 +17,8 @@ describe('StoreStressConcurrent', () => {
17 let print;
18
19 beforeEach(() => {
20 + global.IS_REACT_ACT_ENVIRONMENT = true;
21 +
22 bridge = global.bridge;
23 store = global.store;
24 store.collapseNodesByDefault = false;
@@ -31,12 +33,6 @@ describe('StoreStressConcurrent', () => {
33 print = require('./__serializers__/storeSerializer').print;
34 });
35
34 - // TODO: Remove this in favor of @gate pragma
35 - if (!__EXPERIMENTAL__) {
36 - it("empty test so Jest doesn't complain", () => {});
37 - return;
38 - }
39 -
36 // This is a stress test for the tree mount/update/unmount traversal.
37 // It renders different trees that should produce the same output.
38 // @reactVersion >= 18.0
packages/react-devtools-shared/src/__tests__/treeContext-test.js
+2
@@ -33,6 +33,8 @@ describe('TreeListContext', () => {
33 let state: StateContext;
34
35 beforeEach(() => {
36 + global.IS_REACT_ACT_ENVIRONMENT = true;
37 +
38 utils = require('./utils');
39 utils.beforeEachProfiling();
40