Skip to content

Commit

Permalink
Add component stacks to (almost) all warnings (#17586)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Dec 12, 2019
1 parent dc9b250 commit 995a837
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ReactTestRendererAct.js
Expand Up @@ -14,7 +14,7 @@ import {
IsThisRendererActing,
} from 'react-reconciler/inline.test';
import ReactSharedInternals from 'shared/ReactSharedInternals';
import warningWithoutStack from 'shared/warningWithoutStack';
import warning from 'shared/warning';
import enqueueTask from 'shared/enqueueTask';
import * as Scheduler from 'scheduler';

Expand Down Expand Up @@ -83,7 +83,7 @@ function act(callback: () => Thenable) {
if (__DEV__) {
if (actingUpdatesScopeDepth > previousActingUpdatesScopeDepth) {
// if it's _less than_ previousActingUpdatesScopeDepth, then we can assume the 'other' one has warned
warningWithoutStack(
warning(
'You seem to have overlapping act() calls, this is not supported. ' +
'Be sure to await previous act() calls before making a new one. ',
);
Expand Down Expand Up @@ -115,7 +115,7 @@ function act(callback: () => Thenable) {
.then(() => {})
.then(() => {
if (called === false) {
warningWithoutStack(
warning(
'You called act(async () => ...) without await. ' +
'This could lead to unexpected testing behaviour, interleaving multiple act ' +
'calls and mixing their scopes. You should - await act(async () => ...);',
Expand Down Expand Up @@ -163,7 +163,7 @@ function act(callback: () => Thenable) {
} else {
if (__DEV__) {
if (result !== undefined) {
warningWithoutStack(
warning(
'The callback passed to act(...) function ' +
'must return undefined, or a Promise. You returned %s',
result,
Expand Down Expand Up @@ -191,7 +191,7 @@ function act(callback: () => Thenable) {
return {
then(resolve: () => void) {
if (__DEV__) {
warningWithoutStack(
warning(
'Do not await the result of calling act(...) with sync logic, it is not a Promise.',
);
}
Expand Down

0 comments on commit 995a837

Please sign in to comment.