Skip to content

Commit

Permalink
feat(integration tests): added env variables resolving to react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
aeddi committed Jan 25, 2019
1 parent 94ab56c commit f424b39
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
20 changes: 20 additions & 0 deletions client/react-native/common/index.js
Expand Up @@ -7,7 +7,27 @@ import ReactDOM from 'react-dom'

import App from './components/App'

if (process.env['ENVIRONMENT'] === 'integration_test') {
console.error('LOLOLOLOLOL')
}
// import { Tester, TestHookStore } from 'cavy'
// import AppSpec from './specs/AppSpec'
//
// const testHookStore = new TestHookStore()
//
// class AppWrapper extends Component {
// render() {
// return (
// <Tester specs={[AppSpec]} store={testHookStore} waitTime={4000}>
// <App />
// </Tester>
// )
// }
// }
//

if (Platform.OS === 'web') {
console.error('LILILI')
import('./helpers/patch-web.js')
ReactDOM.render(<App />, document.getElementById('root'))
import('./registerServiceWorker').then()
Expand Down
4 changes: 3 additions & 1 deletion client/react-native/package.json
Expand Up @@ -13,6 +13,7 @@
"b64-lite": "^1.3.1",
"babel-plugin-relay": "^1.6.2",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"case": "^1.6.0",
"concurrently": "^4.0.1",
"crypto-js": "^3.1.9-1",
Expand Down Expand Up @@ -87,7 +88,8 @@
"plugins": [
"@babel/plugin-syntax-export-namespace-from",
"transform-export-extensions",
"relay"
"relay",
"transform-inline-environment-variables"
]
}
}
2 changes: 1 addition & 1 deletion client/react-native/web/config/webpack.config.dev.js
Expand Up @@ -10,7 +10,6 @@ const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent')
const getClientEnvironment = require('./env')
const paths = require('./paths')
const ManifestPlugin = require('webpack-manifest-plugin')
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier')
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin')

// Webpack uses `publicPath` to determine where the app is being served from.
Expand Down Expand Up @@ -215,6 +214,7 @@ module.exports = {
],
plugins: [
'react-native-web',
require.resolve('babel-plugin-transform-inline-environment-variables'),
require.resolve('@babel/plugin-proposal-export-namespace-from'),
require.resolve('babel-plugin-relay'),
[
Expand Down
2 changes: 1 addition & 1 deletion client/react-native/web/config/webpack.config.prod.js
Expand Up @@ -14,7 +14,6 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin')
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent')
const paths = require('./paths')
const getClientEnvironment = require('./env')
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier')
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin')

// Webpack uses `publicPath` to determine where the app is being served from.
Expand Down Expand Up @@ -285,6 +284,7 @@ module.exports = {
],
plugins: [
'react-native-web',
require.resolve('babel-plugin-transform-inline-environment-variables'),
require.resolve('@babel/plugin-proposal-export-namespace-from'),
require.resolve('babel-plugin-relay'),
[
Expand Down
4 changes: 4 additions & 0 deletions client/react-native/yarn.lock
Expand Up @@ -1250,6 +1250,10 @@ babel-plugin-transform-flow-strip-types@^6.8.0:
babel-plugin-syntax-flow "^6.18.0"
babel-runtime "^6.22.0"

babel-plugin-transform-inline-environment-variables@^0.4.3:
version "0.4.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-inline-environment-variables/-/babel-plugin-transform-inline-environment-variables-0.4.3.tgz#a3b09883353be8b5e2336e3ff1ef8a5d93f9c489"

babel-plugin-transform-object-rest-spread@^6.8.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
Expand Down

0 comments on commit f424b39

Please sign in to comment.