Skip to content

Commit 995a837

Browse files
authored
Add component stacks to (almost) all warnings (#17586)
1 parent dc9b250 commit 995a837

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ReactTestRendererAct.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
IsThisRendererActing,
1515
} from 'react-reconciler/inline.test';
1616
import ReactSharedInternals from 'shared/ReactSharedInternals';
17-
import warningWithoutStack from 'shared/warningWithoutStack';
17+
import warning from 'shared/warning';
1818
import enqueueTask from 'shared/enqueueTask';
1919
import * as Scheduler from 'scheduler';
2020

@@ -83,7 +83,7 @@ function act(callback: () => Thenable) {
8383
if (__DEV__) {
8484
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
8585
// if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
86-
warningWithoutStack(
86+
warning(
8787
'You seem to have overlapping act() calls, this is not supported. ' +
8888
'Be sure to await previous act() calls before making a new one. ',
8989
);
@@ -115,7 +115,7 @@ function act(callback: () => Thenable) {
115115
.then(() => {})
116116
.then(() => {
117117
if (called === false) {
118-
warningWithoutStack(
118+
warning(
119119
'You called act(async () => ...) without await. ' +
120120
'This could lead to unexpected testing behaviour, interleaving multiple act ' +
121121
'calls and mixing their scopes. You should - await act(async () => ...);',
@@ -163,7 +163,7 @@ function act(callback: () => Thenable) {
163163
} else {
164164
if (__DEV__) {
165165
if (result !== undefined) {
166-
warningWithoutStack(
166+
warning(
167167
'The callback passed to act(...) function ' +
168168
'must return undefined, or a Promise. You returned %s',
169169
result,
@@ -191,7 +191,7 @@ function act(callback: () => Thenable) {
191191
return {
192192
then(resolve: () => void) {
193193
if (__DEV__) {
194-
warningWithoutStack(
194+
warning(
195195
'Do not await the result of calling act(...) with sync logic, it is not a Promise.',
196196
);
197197
}

0 commit comments

Comments
 (0)