Skip to content

Commit

Permalink
fix: define IS_ACT_ENVIRONMENT global for tests with concurrent mode …
Browse files Browse the repository at this point in the history
…and synchronous act (#28296)
  • Loading branch information
hoxyq committed Feb 9, 2024
1 parent d27c1ac commit 374fd68
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ describe('Fast Refresh', () => {
let withErrorsOrWarningsIgnored;

beforeEach(() => {
global.IS_REACT_ACT_ENVIRONMENT = true;

exportsObj = undefined;

babel = require('@babel/core');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ describe('ProfilerStore', () => {
let utils;

beforeEach(() => {
global.IS_REACT_ACT_ENVIRONMENT = true;

utils = require('./utils');
utils.beforeEachProfiling();

Expand Down
2 changes: 2 additions & 0 deletions packages/react-devtools-shared/src/__tests__/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ describe('Store', () => {
let withErrorsOrWarningsIgnored;

beforeEach(() => {
global.IS_REACT_ACT_ENVIRONMENT = true;

agent = global.agent;
bridge = global.bridge;
store = global.store;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ describe('StoreStressConcurrent', () => {
let print;

beforeEach(() => {
global.IS_REACT_ACT_ENVIRONMENT = true;

bridge = global.bridge;
store = global.store;
store.collapseNodesByDefault = false;
Expand All @@ -31,12 +33,6 @@ describe('StoreStressConcurrent', () => {
print = require('./__serializers__/storeSerializer').print;
});

// TODO: Remove this in favor of @gate pragma
if (!__EXPERIMENTAL__) {
it("empty test so Jest doesn't complain", () => {});
return;
}

// This is a stress test for the tree mount/update/unmount traversal.
// It renders different trees that should produce the same output.
// @reactVersion >= 18.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ describe('TreeListContext', () => {
let state: StateContext;

beforeEach(() => {
global.IS_REACT_ACT_ENVIRONMENT = true;

utils = require('./utils');
utils.beforeEachProfiling();

Expand Down

0 comments on commit 374fd68

Please sign in to comment.