Migration guide当前停留在12.7.0,而最新版本是13.2.0,并且(紧随其后)引入了重大更改。
对于我自己,我更新到13.1(之前也更新到12.11),并且超时(在初始化后用xxx is not defined
),应用启动但立即关闭。
我以config.json
为例,尝试再次清理并构建排毒缓存,清理我的iOS构建文件夹,从10.1到10.2.1,重新安装最新的applesimutils,没有任何变化。
依赖项:
我的package.json:
{
"scripts": {
"start:e2e": "REACT_NATIVE_FLAVOR=E2E npm run -s start:clean",
"build:ios:cmd": "cd ios && export RCT_NO_LAUNCH_PACKAGER=1 && xcodebuild -workspace Coorpacademy.xcworkspace -scheme Coorpacademy -derivedDataPath build",
"build:iphonesimulator:debug": "REACT_NATIVE_FLAVOR=E2E npm run build:ios:cmd -- -configuration Debug -sdk iphonesimulator | xcpretty",
"prebuild:iphonesimulator:release": "REACT_NATIVE_FLAVOR=E2E npm run -s generate:bundle:ios",
"build:iphonesimulator:release": "REACT_NATIVE_FLAVOR=E2E npm run build:ios:cmd -- -configuration Release -sdk iphonesimulator | xcpretty",
"build:androidemulator:debug": "cd android && export REACT_NATIVE_FLAVOR=E2E && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"build:androidemulator:release": "cd android && export REACT_NATIVE_FLAVOR=E2E && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
"test:end2end:ios:debug": "npm run test:end2end:ios:debug:build && npm run test:end2end:ios:debug:test",
"test:end2end:ios:debug:build": "detox build --configuration=ios.simulator.debug",
"test:end2end:ios:debug:test": "detox test --configuration=ios.simulator.debug",
"test:end2end:ios:release": "npm run test:end2end:ios:release:build && npm run test:end2end:ios:release:test",
"test:end2end:ios:release:build": "detox build --configuration=ios.simulator.release",
"test:end2end:ios:release:test": "detox test --configuration=ios.simulator.release",
"test:end2end:android:debug": "npm run test:end2end:android:debug:build && npm run test:end2end:android:debug:test",
"test:end2end:android:debug:build": "detox build --configuration=android.emulator.debug",
"test:end2end:android:debug:test": "detox test --configuration=android.emulator.debug",
"test:end2end:android:release": "npm run test:end2end:android:release:build && npm run test:end2end:android:release:test",
"test:end2end:android:release:build": "detox build --configuration=android.emulator.release",
"test:end2end:android:release:test": "detox test --configuration=android.emulator.release",
},
"detox": {
"test-runner": "jest",
"runner-config": "jest.config.e2e.js",
"configurations": {
"ios.simulator.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/Coorpacademy.app",
"build": "npm run build:iphonesimulator:debug",
"type": "ios.simulator",
"name": "iPhone 6"
},
"ios.simulator.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/Coorpacademy.app",
"build": "npm run build:iphonesimulator:release",
"type": "ios.simulator",
"name": "iPhone 6"
},
"android.emulator.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/Coorpacademy-debug.apk",
"build": "npm run build:androidemulator:debug",
"type": "android.emulator",
"name": "Nexus_5X_API_19"
},
"android.emulator.release": {
"binaryPath": "android/app/build/outputs/apk/release/Coorpacademy-release.apk",
"build": "npm run build:androidemulator:release",
"type": "android.emulator",
"name": "Nexus_5X_API_19"
}
}
}
}
我的地铁配置:
const createBlacklist = require('metro-config/src/defaults/blacklist');
const {REACT_NATIVE_FLAVOR} = process.env;
module.exports = {
resolver: {
sourceExts: REACT_NATIVE_FLAVOR === 'E2E' ? ['e2e.js', 'js'] : ['js'],
blacklistRE: (() => {
if (REACT_NATIVE_FLAVOR === 'STORYBOOK') {
// this is to have fixtures embedded in storybook app
return createBlacklist([]);
}
})()
},
transformer: {
getTransformOptions: () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false
}
})
}
};
我的笑话配置:
module.exports = {
testEnvironment: 'node',
moduleFileExtensions: ['unit.js', 'unit.json', 'ios.js', 'android.js', 'js', 'json'],
setupFilesAfterEnv: ['./__e2e__/init.js'],
reporters: ['detox/runners/jest/streamlineReporter'],
bail: true,
verbose: true
};
还有我的初始化文件:
import detox from 'detox';
import adapter from 'detox/runners/jest/adapter';
import specReporter from 'detox/runners/jest/specReporter';
import json from '../package';
const config = json.detox;
jest.setTimeout(120000);
// $FlowFixMe jest flow type is incomplete
jasmine.getEnv().addReporter(adapter);
// $FlowFixMe jest flow type is incomplete
jasmine.getEnv().addReporter(specReporter);
beforeAll(async () => {
await detox.init(config);
global.weExpect = expect;
});
beforeEach(async function() {
await adapter.beforeEach();
});
afterAll(async () => {
await adapter.afterAll();
await detox.cleanup();
});
答案 0 :(得分:0)
如对一个问题所讨论的那样,没有重大变更需要迁移指南中的条目。输入了重大更改,并且有可能破坏许多工作环境,因此,我认为突破主要版本更安全,减少被干扰的用户的风险。为了清楚起见,我更新了迁移指南的简介部分,也对此进行了说明。
13.1中引入了一项更改,导致某些iOS应用程序出现问题。此问题已在13.2中修复,因此请升级到该版本,看看是否可以解决您的问题。如果没有,请打开错误报告并提供所有必需的信息。