From 995a83772d251cdb69d71d0f9b8d7809ee8b58d9 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 12 Dec 2019 23:47:55 +0000 Subject: [PATCH] Add component stacks to (almost) all warnings (#17586) --- src/ReactTestRendererAct.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ReactTestRendererAct.js b/src/ReactTestRendererAct.js index d999c4c..3e097ab 100644 --- a/src/ReactTestRendererAct.js +++ b/src/ReactTestRendererAct.js @@ -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'; @@ -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. ', ); @@ -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 () => ...);', @@ -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, @@ -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.', ); }