我是Travis CI的新手,基本上我的项目是使用非常基本的排毒测试的HelloWorld react-native
。该测试在我的本地计算机上运行良好,但是进行测试时在Travis上遇到了超时错误。
我的travis.yml
是排毒文档的主要内容:
language: objective-c
osx_image: xcode10.2
branches:
only:
- master
env:
global:
- NODE_VERSION=stable
install:
- brew tap wix/brew
- brew install applesimutils
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
- export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
- nvm install $NODE_VERSION
- nvm use $NODE_VERSION
- nvm alias default $NODE_VERSION
- npm install -g react-native-cli
- npm install -g detox-cli
- npm install
script:
- detox build --configuration ios.sim.release
- detox test --configuration ios.sim.release --cleanup
firstTest.spec.js
排毒测试:
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
});
it('should have welcome screen', async () => {
await expect(element(by.id('welcome'))).toBeVisible();
});
});
Travis日志:
[1m[37mExample[39m[22m: [90mshould have welcome screen[39m
[1m[37mExample[39m[22m: [90mshould have welcome screen[39m[90m [[31mFAIL[90m][39m
[0m[7m[1m[31m FAIL [39m[22m[27m[0m [2me2e/[22m[1mfirstTest.spec.js[22m ([0m[1m[41m513.126s[49m[22m[0m)
Example
[31m✕[39m [2mshould have welcome screen (38ms)[22m
[1m[31m [1m◠[1mExample › should have welcome screen[39m[22m
Timeout - Async callback was not invoked within the 500000ms timeout specified by jest.setTimeout.Error: Timeout - Async callback was not invoked within the 500000ms timeout specified by jest.setTimeout.
[2m[22m
[2m [2mat mapper ([2m../node_modules/jest-jasmine2/build/queueRunner.js[2m:25:45)[2m[22m
[1m[31m [1m◠[1mExample › should have welcome screen[39m[22m
ReferenceError: device is not defined
这是我的package.json
设置:
我还运行了基本的Jest untit测试
"jest": {
"preset": "react-native",
"testMatch": [
"<rootDir>/__tests__/**/*.js?(x)",
"<rootDir>/src/**/*.test.js"
],
"setupFiles": [
"<rootDir>/setupTests.js"
],
"transformIgnorePatterns": [
...
]
},
"detox": {
"test-runner": "jest",
"runner-config": "e2e/config.json",
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
"build": "xcodebuild -project ios/example.xcodeproj -UseNewBuildSystem=NO -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"name": "iPhone X"
}
}
}
在我的本地机器上
detox test --configuration ios.sim.debug --cleanup
工作正常。