Skip to content

Commit 5b07b1a

Browse files
committed
a better message, consistent with the state update one.
1 parent c777608 commit 5b07b1a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

packages/react-dom/src/__tests__/ReactDOMHooks-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ describe('ReactDOMHooks', () => {
7474
expect(container2.textContent).toBe('4');
7575
expect(container3.textContent).toBe('6');
7676
}).toWarnDev([
77-
'Your test just caused an effect from Example1',
78-
'Your test just caused an effect from Example2',
79-
'Your test just caused an effect from Example1',
80-
'Your test just caused an effect from Example2',
77+
'An update to Example1 ran an effect',
78+
'An update to Example2 ran an effect',
79+
'An update to Example1 ran an effect',
80+
'An update to Example2 ran an effect',
8181
]);
8282
});
8383

packages/react-reconciler/src/ReactFiberWorkLoop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ export function warnIfNotCurrentlyActingEffectsInDEV(fiber: Fiber): void {
24342434
if (ReactCurrentActingRendererSigil.current !== ReactActingRendererSigil) {
24352435
warningWithoutStack(
24362436
false,
2437-
'Your test just caused an effect from %s, but was not wrapped in act(...).\n\n' +
2437+
'An update to %s ran an effect, but was not wrapped in act(...).\n\n' +
24382438
'When testing, code that causes React state updates should be ' +
24392439
'wrapped into act(...):\n\n' +
24402440
'act(() => {\n' +

packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ describe('ReactHooks', () => {
18001800
globalListener();
18011801
globalListener();
18021802
}).toWarnDev([
1803-
'Your test just caused an effect from C',
1803+
'An update to C ran an effect',
18041804
'An update to C inside a test was not wrapped in act',
18051805
'An update to C inside a test was not wrapped in act',
18061806
// Note: should *not* warn about updates on unmounted component.

packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.internal.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ describe('ReactHooksWithNoopRenderer', () => {
892892
);
893893
expect(Scheduler).toFlushAndYieldThrough(['Count: 0', 'Sync effect']);
894894
expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);
895-
}).toWarnDev(['Your test just caused an effect from Counter']);
895+
}).toWarnDev(['An update to Counter ran an effect']);
896896

897897
// A discrete event forces the passive effect to be flushed --
898898
// updateCount(1) happens first, so 2 wins.
@@ -907,8 +907,8 @@ describe('ReactHooksWithNoopRenderer', () => {
907907
expect(() => {
908908
expect(Scheduler).toFlushAndYield(['Count: 2']);
909909
}).toWarnDev([
910-
'Your test just caused an effect from Counter',
911-
'Your test just caused an effect from Counter',
910+
'An update to Counter ran an effect',
911+
'An update to Counter ran an effect',
912912
]);
913913

914914
expect(ReactNoop.getChildren()).toEqual([span('Count: 2')]);
@@ -956,7 +956,7 @@ describe('ReactHooksWithNoopRenderer', () => {
956956
);
957957
expect(Scheduler).toFlushAndYieldThrough(['Count: 0', 'Sync effect']);
958958
expect(ReactNoop.getChildren()).toEqual([span('Count: 0')]);
959-
}).toWarnDev(['Your test just caused an effect from Counter']);
959+
}).toWarnDev(['An update to Counter ran an effect']);
960960

961961
expect(onInteractionScheduledWorkCompleted).toHaveBeenCalledTimes(0);
962962

@@ -973,8 +973,8 @@ describe('ReactHooksWithNoopRenderer', () => {
973973
expect(() => {
974974
expect(Scheduler).toFlushAndYield(['Count: 2']);
975975
}).toWarnDev([
976-
'Your test just caused an effect from Counter',
977-
'Your test just caused an effect from Counter',
976+
'An update to Counter ran an effect',
977+
'An update to Counter ran an effect',
978978
]);
979979

980980
expect(ReactNoop.getChildren()).toEqual([span('Count: 2')]);

0 commit comments

Comments
 (0)