-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detox integration with jest - Jest did not exit one second after the test run has completed. #1046
Comments
As a workaround, try |
There's too much configuration here to try reproducing it outside your project. |
@stevechun if I run detox test -c ios.sim.debug --forceExit became this error =>
if I add "force":true in config.json then it throw this message =>
@rotemmiz i have create simple git repo (https://github.com/scriptMQL/testProject) with the same issue |
its not an issue about detox. it was an issue in my code. |
Met the same issue. How did you resolve this? @scriptMQL |
i had an issue in my code
after:
i have remove my helper functions and the test are running. So I will refactor my code. |
Description
hey guys i will run in my project unit test by jest and end to end test by detox. All my jest test work fine , but when i start detox withthe command "detox test -c ios.sim.debug --loglevel verbose" it go until the cleanup function and stop. Then call the "Jest did not exit one second after the test run has completed."
I have test forceExit but it doesn't work. issues387
Steps to Reproduce
"jest": { "preset": "react-native", "verbose": true, "testPathIgnorePatterns": [ "node_modules" ], "unmockedModulePathPatterns": [ "node_modules/react/", "node_modules/enzyme/" ], "setupFiles": [ "./config/enzyme.js" ], "snapshotSerializers": [ "enzyme-to-json/serializer" ], "transform": { "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js", "^.+\\.jsx?$": "babel-jest" }, "transformIgnorePatterns": [ "node_modules/(?!react-native|react-navigation)/" ], "testMatch": [ "<rootDir>/**/**/**/__tests__/*.test.js?(x)", "<rootDir>/**/**/**/__tests__/*.test.js" ] },"detox": { "test-runner": "jest", "setupTestFrameworkScriptFile": "./e2e/init.js", "runner-config": "e2e/config.json", "configurations": { "ios.sim.debug": { "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/dummy.app", "build": "xcodebuild -project ios/dummy.xcodeproj -scheme dummy -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build", "type": "ios.simulator", "name": "iPhone X" } }
`// config/enzyme.js
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
`
{ "setupTestFrameworkScriptFile": "./init.js" }
`
const detox = require('detox');
const config = require('../package.json').detox;
const adapter = require('detox/runners/jest/adapter');
const { execSync } = require('child_process');
execSync('react-native run-ios');
// Set the default timeout
jest.setTimeout(40000);
jasmine.getEnv().addReporter(adapter);
// jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
beforeAll(async () => {
await detox.init(config);
console.log('********************* INIT.js -> beforeAll');
});
beforeEach(async () => {
await adapter.beforeEach();
console.log('********************* INIT.js -> beforeEach');
});
afterAll(async () => {
console.log('********************* INIT.js -> befor adapter.afterAll');
await adapter.afterAll();
console.log('********************* INIT.js -> after adapter.afterAll / before cleanup');
await detox.cleanup();
console.log('********************* INIT.js -> after cleanup');
console.log('EXIT');
});
`
`
/* eslint-disable */
import { recordVideo, killSimctl } from '../init';
describe('panel test', () => {
beforeEach(async () => {
await device.reloadReactNative();
console.log('********************* test.js -> reloadReactNative');
recordVideo();
console.log('********************* test.js -> recordVideo');
});
});
`
Device and verbose Detox logs
detox test -c ios.sim.debug --loglevel verbose
configuration="ios.sim.debug" loglevel="verbose" artifactsLocation="artifacts/ios.sim.debug.2018-11-15 09-16-09Z" node_modules/.bin/jest e2e --config=e2e/config.json --maxWorkers=1 '--testNamePattern=^((?!:android:).)*$'
The following commands produced analyzer issues:
Analyze Base/RCTModuleMethod.mm normal x86_64
Analyze RCTImageCache.m normal x86_64
Analyze RCTNetInfo.m normal x86_64
(3 commands with analyzer issues)
detox[76121] INFO: [DetoxServer.js] server listening on localhost:61140...
detox[76121] DEBUG: [AsyncWebSocket.js/WEBSOCKET_OPEN] opened web socket to: ws://localhost:61140
detox[76121] DEBUG: [DetoxServer.js/LOGIN] role=tester, sessionId=c4494a8d-2dbd-47f2-c835-d04eb5ced034
detox[76121] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=tester, sessionId=c4494a8d-2dbd-47f2-c835-d04eb5ced034
detox[76121] DEBUG: [exec.js/EXEC_CMD, #0] /usr/bin/xcrun simctl list -j
detox[76121] DEBUG: [exec.js/EXEC_CMD, #1] applesimutils --list --byType "iPhone X" --byOS "11.4"
detox[76121] DEBUG: [exec.js/EXEC_TRY, #1] Searching for device matching iPhone X...
detox[76121] DEBUG: [exec.js/EXEC_CMD, #2] applesimutils --list --byId "6CE321B7-F402-4667-B4E8-4284836B7FFB"
detox[76121] DEBUG: [exec.js/EXEC_CMD, #3] /usr/bin/xcrun simctl uninstall 6CE321B7-F402-4667-B4E8-4284836B7FFB org.reactjs.native.example.dummy
detox[76121] DEBUG: [exec.js/EXEC_TRY, #3] Uninstalling org.reactjs.native.example.dummy...
detox[76121] DEBUG: [exec.js/EXEC_SUCCESS, #3] org.reactjs.native.example.dummy uninstalled
detox[76121] DEBUG: [exec.js/EXEC_CMD, #4] /usr/bin/xcrun simctl install 6CE321B7-F402-4667-B4E8-4284836B7FFB "/Users/pascal/Documents/GitLab/component-library-explorer-s
ovanta/ios/build/Build/Products/Debug-iphonesimulator/dummy.app"
detox[76121] DEBUG: [exec.js/EXEC_TRY, #4] Installing /Users/pascal./Documents/GitLab/dummy/ios/build/Build/Products/Debug-iphonesimulator/dummy.app...
detox[76121] DEBUG: [exec.js/EXEC_SUCCESS, #4] /Users/pascal.renner/Documents/GitLab/dummy/ios/build/Build/Products/Debug-iphonesimulator/RNLibraryE
xplorerSovanta.app installed
detox[76121] DEBUG: [exec.js/EXEC_CMD, #5] /usr/bin/xcrun simctl terminate 6CE321B7-F402-4667-B4E8-4284836B7FFB org.reactjs.native.example.dummy
detox[76121] DEBUG: [exec.js/EXEC_TRY, #5] Terminating org.reactjs.native.example.dummy...
detox[76121] DEBUG: [exec.js/EXEC_SUCCESS, #5] org.reactjs.native.example.dummy terminated
detox[76121] DEBUG: [exec.js/EXEC_CMD, #6] /bin/cat /dev/null >/Users/pascal/Library/Developer/CoreSimulator/Devices/6CE321B7-F402-4667-B4E8-4284836B7FFB/data/tmp/detox.l
ast_launch_app_log.out 2>/Users/pascal/Library/Developer/CoreSimulator/Devices/6CE321B7-F402-4667-B4E8-4284836B7FFB/data/tmp/detox.last_launch_app_log.err && SIMCTL_CHILD
_DYLD_INSERT_LIBRARIES="/Users/pascal/Library/Detox/ios/8fda9ea8145fa9ba6f1cc9b085eed5d8c6f7bc77/Detox.framework/Detox" /usr/bin/xcrun simctl launch --stdout=/tmp/detox.last_launch_app_log.out --stderr=/tmp/detox.last_launch_app_log.err 6CE321B7-F402-4667-B4E8-4284836B7FFB org.reactjs.native.example.dummy --args -detoxServer ws://localhost:61140 -detoxSessionId c4494a8d-2dbd-47f2-c835-d04eb5ced034
detox[76121] DEBUG: [exec.js/EXEC_TRY, #6] Launching org.reactjs.native.example.dummy...
detox[76121] DEBUG: [exec.js/EXEC_SUCCESS, #6] org.reactjs.native.example.dummy launched. The stdout and stderr logs were recreated, you can watch them with:
tail -F /Users/pascal/Library/Developer/CoreSimulator/Devices/6CE321B7-F402-4667-B4E8-4284836B7FFB/data/tmp/detox.last_launch_app_log.{out,err}
detox[76121] DEBUG: [DetoxServer.js/CANNOT_FORWARD] role=testee not connected, cannot fw action (sessionId=c4494a8d-2dbd-47f2-c835-d04eb5ced034)
detox[76121] DEBUG: [DetoxServer.js/LOGIN] role=testee, sessionId=c4494a8d-2dbd-47f2-c835-d04eb5ced034
detox[76121] DEBUG: [DetoxServer.js/LOGIN_SUCCESS] role=testee, sessionId=c4494a8d-2dbd-47f2-c835-d04eb5ced034
console.log e2e/init.js:15
********************* INIT.js -> beforeAll
console.log e2e/init.js:20
********************* INIT.js -> beforeEach
console.log e2e/e2e/template.e2e.test.js:7
********************* test.js -> reloadReactNative
detox[76121] DEBUG: [exec.js/EXEC_CMD, #7] /usr/bin/xcrun simctl terminate 6CE321B7-F402-4667-B4E8-4284836B7FFB org.reactjs.native.example.dummy
detox[76121] DEBUG: [exec.js/EXEC_TRY, #7] Terminating org.reactjs.native.example.dummy..
detox[76121] DEBUG: [exec.js/EXEC_SUCCESS, #7] org.reactjs.native.example.dummy terminated
console.log e2e/e2e/template.e2e.test.js:14
********************* test.js -> terminateApp
console.log e2e/init.js:24
********************* INIT.js -> befor adapter.afterAll
console.log e2e/init.js:26
********************* INIT.js -> after adapter.afterAll / before cleanup
detox[76121] DEBUG: [DetoxServer.js/DISCONNECT] role=testee, sessionId=c4494a8d-2dbd-47f2-c835-d04eb5ced034
FAIL e2e/e2e/template.e2e.test.js
● Test suite failed to run
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 177.589s
Ran all test suites matching /e2e/i with tests matching "^((?!:android:).)*$".
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with
--detectOpenHandles
to troubleshoot this issue.The text was updated successfully, but these errors were encountered: