From d266181d11cd3013a691e391b22b39b3a305e0fc Mon Sep 17 00:00:00 2001 From: handtrix Date: Tue, 18 Sep 2018 14:58:19 +0200 Subject: [PATCH] Keep warnings when process.env.NODE_ENV is not production MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way the following warnings will work in test mode. (`process.env.NODE_ENV === „test“`) --- lib/error.js | 2 +- lib/router/router.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/error.js b/lib/error.js index 9d22f02f25e58..5927651ee2fd8 100644 --- a/lib/error.js +++ b/lib/error.js @@ -31,7 +31,7 @@ export default class Error extends React.Component { } } -if (process.env.NODE_ENV === 'development') { +if (process.env.NODE_ENV !== 'production') { Error.propTypes = { statusCode: PropTypes.number } diff --git a/lib/router/router.js b/lib/router/router.js index 61e6a07e7c6f4..bc63716d3e0fb 100644 --- a/lib/router/router.js +++ b/lib/router/router.js @@ -78,7 +78,7 @@ export default class Router { } const { url, as, options } = e.state - if (process.env.NODE_ENV === 'development') { + if (process.env.NODE_ENV !== 'production') { if (typeof url === 'undefined' || typeof as === 'undefined') { console.warn('`popstate` event triggered but `event.state` did not have `url` or `as` https://err.sh/zeit/next.js/popstate-state-empty') }