mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-22 19:57:51 +08:00
[tests] wip - upgrade tests to detox 9 / babel 7 / rn 57
This commit is contained in:
@@ -10,10 +10,18 @@ async function waitForPackager() {
|
||||
while (waitAttempts < maxWaitAttempts) {
|
||||
console.log(`Waiting for packager to be ready, attempt ${waitAttempts} of ${maxWaitAttempts}...`);
|
||||
const [error, response] = await A2A(axios.get('http://localhost:8081/status', { timeout: 500 }));
|
||||
// metro bundler only
|
||||
if (error && error.response && error.response.data && error.response.data.includes('Cannot GET /status')) {
|
||||
ready = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// rn-cli only
|
||||
if (!error && response.data.includes('packager-status:running')) {
|
||||
ready = true;
|
||||
break;
|
||||
}
|
||||
|
||||
await sleep(1500);
|
||||
waitAttempts++;
|
||||
}
|
||||
|
||||
11124
package-lock.json
generated
11124
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -70,13 +70,14 @@
|
||||
"crashlytics"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"react": ">= 16.4.1",
|
||||
"react-native": ">= 0.57.0-rc.3",
|
||||
"react": ">= 16.5.0",
|
||||
"react-native": ">= 0.57.0-rc.4",
|
||||
"fbjs": "*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"@invertase/babel-preset-react-native-syntax": "^0.1.3",
|
||||
"axios": "^0.18.0",
|
||||
"babel-eslint": "^9.0.0",
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"presets": [
|
||||
"react-native"
|
||||
],
|
||||
"env": {
|
||||
"development": {
|
||||
"plugins": [
|
||||
[
|
||||
"module-resolver",
|
||||
{
|
||||
"alias": {
|
||||
"react-native-firebase": ".."
|
||||
},
|
||||
"extensions": [".js", ".ios.js", ".android.js"],
|
||||
"stripExtensions": [".js"]
|
||||
}
|
||||
],
|
||||
[
|
||||
"istanbul",
|
||||
{
|
||||
"useInlineSourceMaps": true,
|
||||
"instrument": true,
|
||||
"relativePath": false,
|
||||
"include": [
|
||||
"**/src/**"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import React, { Component } from 'react';
|
||||
import { AppRegistry, Text, View } from 'react-native';
|
||||
|
||||
import bridge from 'jet/platform/react-native';
|
||||
import firebase from 'react-native-firebase/src';
|
||||
import firebase from 'react-native-firebase';
|
||||
|
||||
require('sinon');
|
||||
require('should-sinon');
|
||||
|
||||
38
tests/babel.config.js
Normal file
38
tests/babel.config.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const { resolve } = require('path');
|
||||
|
||||
module.exports = {
|
||||
presets: ['module:metro-react-native-babel-preset'],
|
||||
plugins: [
|
||||
[
|
||||
'module-resolver',
|
||||
{
|
||||
alias: {
|
||||
// import library code from parent
|
||||
'react-native-firebase': resolve(__dirname, '../src'),
|
||||
|
||||
// TODO - errors without this =/ rn57 not correctly providing babelHelpers?
|
||||
'@babel/runtime': resolve(__dirname, 'node_modules/@babel/runtime'),
|
||||
},
|
||||
extensions: ['.js', '.ts', '.tsx', '.css'],
|
||||
root: ['./'],
|
||||
},
|
||||
],
|
||||
// TODO - errors without this =/ rn57 not correctly providing babelHelpers?
|
||||
[
|
||||
require('@babel/plugin-transform-runtime'),
|
||||
{
|
||||
helpers: true,
|
||||
regenerator: true,
|
||||
},
|
||||
],
|
||||
[
|
||||
'istanbul',
|
||||
{
|
||||
instrument: true,
|
||||
relativePath: false,
|
||||
include: ['**/src/**'],
|
||||
useInlineSourceMaps: true,
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
require('./app');
|
||||
@@ -1 +1,2 @@
|
||||
import interopRequireWildcard from '@babel/runtime/helpers/interopRequireWildcard';
|
||||
require('./app');
|
||||
|
||||
27
tests/metro.config.js
Executable file
27
tests/metro.config.js
Executable file
@@ -0,0 +1,27 @@
|
||||
const { resolve } = require('path');
|
||||
const { createBlacklist } = require('metro');
|
||||
|
||||
const { mergeConfig } = require('metro-config');
|
||||
const { DEFAULT } = require('react-native/local-cli/util/Config');
|
||||
// https://github.com/facebook/react-native/blob/master/local-cli/core/Constants.js
|
||||
// https://github.com/facebook/react-native/blob/master/local-cli/util/Config.js
|
||||
|
||||
const config = {
|
||||
resolver: {
|
||||
blackListRE: createBlacklist([
|
||||
new RegExp(`^${escape(resolve(__dirname, '..', 'node_modules'))}\\/.*$`),
|
||||
]),
|
||||
providesModuleNodeModules: ['react-native', 'react', 'prop-types', 'fbjs'],
|
||||
},
|
||||
watchFolders: [resolve(__dirname, '../src')],
|
||||
transformer: {
|
||||
// TODO
|
||||
},
|
||||
serializer: {
|
||||
getModulesRunBeforeMainModule: () => [
|
||||
// TODO
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = mergeConfig(DEFAULT, config);
|
||||
12385
tests/package-lock.json
generated
12385
tests/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,8 +4,8 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"packager-chrome": "node node_modules/react-native/local-cli/cli.js start --platforms ios,android",
|
||||
"packager-jet": "REACT_DEBUGGER='echo nope' node node_modules/react-native/local-cli/cli.js start --platforms ios,android",
|
||||
"packager-jet-reset-cache": "REACT_DEBUGGER='echo nope' node node_modules/react-native/local-cli/cli.js start --platforms ios,android --reset-cache",
|
||||
"packager-jet": "REACT_DEBUGGER='echo nope' node node_modules/react-native/local-cli/cli.js start",
|
||||
"packager-jet-reset-cache": "REACT_DEBUGGER='echo nope' node node_modules/react-native/local-cli/cli.js start --reset-cache",
|
||||
"build-android": "detox build --configuration android.emu.debug",
|
||||
"build-ios": "detox build --configuration ios.sim.debug",
|
||||
"test": "npm run test-android && test-ios",
|
||||
@@ -20,34 +20,35 @@
|
||||
"ios:pod:install": "cd ios && rm -rf ReactNativeFirebaseDemo.xcworkspace && pod install && cd .."
|
||||
},
|
||||
"dependencies": {
|
||||
"jet": "0.0.2",
|
||||
"detox": "^8.2.3",
|
||||
"detox": "^9.0.1",
|
||||
"fbjs": "^0.8.16",
|
||||
"firebase-admin": "^5.12.0",
|
||||
"jet": "0.0.2",
|
||||
"jsonwebtoken": "^8.2.1",
|
||||
"mocha": "^5.2.0",
|
||||
"prop-types": "^15.6.1",
|
||||
"react": "^16.4.1",
|
||||
"react-native": "^0.56.0",
|
||||
"react": "^16.5.0",
|
||||
"react-native": "^0.57.0-rc.4",
|
||||
"should": "^13.2.1",
|
||||
"should-sinon": "0.0.6",
|
||||
"sinon": "^6.1.4"
|
||||
"sinon": "^6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.0.0-beta.47",
|
||||
"@babel/core": "7.0.0-beta.47",
|
||||
"babel-eslint": "^8.2.6",
|
||||
"@babel/cli": "^7.0.0",
|
||||
"@babel/core": "^7.0.0",
|
||||
"@babel/plugin-transform-runtime": "^7.0.0",
|
||||
"@babel/runtime": "^7.0.0",
|
||||
"babel-eslint": "^9.0.0",
|
||||
"babel-plugin-istanbul": "^5.0.1",
|
||||
"babel-plugin-module-resolver": "^3.1.1",
|
||||
"babel-preset-react-native": "^5.0.2",
|
||||
"eslint": "^5.3.0",
|
||||
"eslint": "^5.5.0",
|
||||
"eslint-config-airbnb": "^17.0.0",
|
||||
"eslint-plugin-flowtype": "^2.46.3",
|
||||
"eslint-plugin-import": "^2.11.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.0.3",
|
||||
"eslint-plugin-react": "^7.7.0",
|
||||
"flow-bin": "^0.78.0",
|
||||
"nyc": "^12.0.2",
|
||||
"nyc": "^13.0.1",
|
||||
"rimraf": "^2.6.2"
|
||||
},
|
||||
"nyc": {
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
const { resolve } = require('path');
|
||||
|
||||
let metroBundler;
|
||||
try {
|
||||
metroBundler = require('metro');
|
||||
} catch (ex) {
|
||||
metroBundler = require('metro-bundler');
|
||||
}
|
||||
|
||||
const blacklist = metroBundler.createBlacklist;
|
||||
|
||||
module.exports = {
|
||||
getProjectRoots() {
|
||||
return [__dirname, resolve(__dirname, '..')];
|
||||
},
|
||||
getProvidesModuleNodeModules() {
|
||||
return ['react-native', 'react', 'prop-types', 'fbjs'];
|
||||
},
|
||||
getBlacklistRE() {
|
||||
return blacklist([
|
||||
new RegExp(`^${escape(resolve(__dirname, '..', 'node_modules'))}\\/.*$`),
|
||||
]);
|
||||
},
|
||||
};
|
||||
3224
tests/yarn.lock
3224
tests/yarn.lock
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user