Fix log handling via env vars in expo
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
# Copy this to `.env` and `.env.test` files
|
||||||
|
|
||||||
SENTRY_AUTH_TOKEN=
|
SENTRY_AUTH_TOKEN=
|
||||||
|
EXPO_PUBLIC_ENV=development
|
||||||
EXPO_PUBLIC_LOG_LEVEL=debug
|
EXPO_PUBLIC_LOG_LEVEL=debug
|
||||||
EXPO_PUBLIC_LOG_DEBUG=
|
EXPO_PUBLIC_LOG_DEBUG=
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
# Testing instructions
|
# Testing instructions
|
||||||
|
|
||||||
|
Make sure you've copied `.env.example` to `.env.test` and provided any required
|
||||||
|
values.
|
||||||
|
|
||||||
### Using Maestro E2E tests
|
### Using Maestro E2E tests
|
||||||
1. Install Maestro by following [these instructions](https://maestro.mobile.dev/getting-started/installing-maestro). This will help us run the E2E tests.
|
1. Install Maestro by following [these instructions](https://maestro.mobile.dev/getting-started/installing-maestro). This will help us run the E2E tests.
|
||||||
2. You can write Maestro tests in `__e2e__/maestro` directory by creating a new `.yaml` file or by modifying an existing one.
|
2. You can write Maestro tests in `__e2e__/maestro` directory by creating a new `.yaml` file or by modifying an existing one.
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
import 'react-native-gesture-handler' // must be first
|
import 'react-native-gesture-handler' // must be first
|
||||||
|
|
||||||
import {LogBox} from 'react-native'
|
import {LogBox} from 'react-native'
|
||||||
LogBox.ignoreLogs(['Require cycle:']) // suppress require-cycle warnings, it's fine
|
|
||||||
|
|
||||||
import '#/platform/polyfills'
|
import '#/platform/polyfills'
|
||||||
|
import {IS_TEST} from '#/env'
|
||||||
import {registerRootComponent} from 'expo'
|
import {registerRootComponent} from 'expo'
|
||||||
import {doPolyfill} from '#/lib/api/api-polyfill'
|
import {doPolyfill} from '#/lib/api/api-polyfill'
|
||||||
doPolyfill()
|
|
||||||
|
|
||||||
import App from '#/App'
|
import App from '#/App'
|
||||||
|
|
||||||
|
doPolyfill()
|
||||||
|
|
||||||
|
if (IS_TEST) {
|
||||||
|
LogBox.ignoreAllLogs() // suppress all logs in tests
|
||||||
|
} else {
|
||||||
|
LogBox.ignoreLogs(['Require cycle:']) // suppress require-cycle warnings, it's fine
|
||||||
|
}
|
||||||
|
|
||||||
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
|
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
|
||||||
// It also ensures that whether you load the app in Expo Go or in a native build,
|
// It also ensures that whether you load the app in Expo Go or in a native build,
|
||||||
// the environment is set up appropriately
|
// the environment is set up appropriately
|
||||||
|
|||||||
+3
-3
@@ -21,9 +21,9 @@
|
|||||||
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
|
"lint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
|
||||||
"typecheck": "tsc --project ./tsconfig.check.json",
|
"typecheck": "tsc --project ./tsconfig.check.json",
|
||||||
"e2e:mock-server": "./jest/dev-infra/with-test-redis-and-db.sh ts-node __e2e__/mock-server.ts",
|
"e2e:mock-server": "./jest/dev-infra/with-test-redis-and-db.sh ts-node __e2e__/mock-server.ts",
|
||||||
"e2e:metro": "RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios",
|
"e2e:metro": "NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios",
|
||||||
"e2e:build": "detox build -c ios.sim.debug",
|
"e2e:build": "NODE_ENV=test detox build -c ios.sim.debug",
|
||||||
"e2e:run": "detox test --configuration ios.sim.debug --take-screenshots all",
|
"e2e:run": "NODE_ENV=test detox test --configuration ios.sim.debug --take-screenshots all",
|
||||||
"perf:test": "NODE_ENV=test maestro test",
|
"perf:test": "NODE_ENV=test maestro test",
|
||||||
"perf:test:run": "NODE_ENV=test maestro test __e2e__/maestro/scroll.yaml",
|
"perf:test:run": "NODE_ENV=test maestro test __e2e__/maestro/scroll.yaml",
|
||||||
"perf:test:measure": "NODE_ENV=test flashlight test --bundleId xyz.blueskyweb.app --testCommand 'yarn perf:test' --duration 150000 --resultsFilePath .perf/results.json",
|
"perf:test:measure": "NODE_ENV=test flashlight test --bundleId xyz.blueskyweb.app --testCommand 'yarn perf:test' --duration 150000 --resultsFilePath .perf/results.json",
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
export const IS_TEST = process.env.NODE_ENV === 'test'
|
export const IS_TEST = process.env.EXPO_PUBLIC_ENV === 'test'
|
||||||
export const IS_DEV = __DEV__
|
export const IS_DEV = __DEV__
|
||||||
export const IS_PROD = !IS_DEV
|
export const IS_PROD = !IS_DEV
|
||||||
export const LOG_DEBUG = process.env.EXPO_PUBLIC_LOG_DEBUG || ''
|
export const LOG_DEBUG = process.env.EXPO_PUBLIC_LOG_DEBUG || ''
|
||||||
|
|||||||
Reference in New Issue
Block a user