From ad674e4b4f71613422a95b60b3edb2c54028336f Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 1 Jul 2019 14:40:25 -0700 Subject: [PATCH] [add] Platform.isTesting --- packages/react-native-web/src/exports/Platform/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native-web/src/exports/Platform/index.js b/packages/react-native-web/src/exports/Platform/index.js index 7df291c56..d7c8f766f 100644 --- a/packages/react-native-web/src/exports/Platform/index.js +++ b/packages/react-native-web/src/exports/Platform/index.js @@ -10,7 +10,13 @@ const Platform = { OS: 'web', - select: (obj: Object) => ('web' in obj ? obj.web : obj.default) + select: (obj: Object) => ('web' in obj ? obj.web : obj.default), + get isTesting(): boolean { + if (process.env.NODE_DEV === 'test') { + return true; + } + return false; + } }; export default Platform;