detox 19.7.0 → 20.0.0-breaking.new-global-lifecycle.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{19.7.0/detox-19.7.0-javadoc.jar → 20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.7.0/detox-19.7.0-sources.jar → 20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.7.0/detox-19.7.0.pom → 20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios.tbz +0 -0
- package/android/detox/src/full/java/com/wix/detox/Detox.java +2 -59
- package/android/detox/src/full/java/com/wix/detox/NotificationDataParser.kt +3 -3
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +3 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +23 -16
- package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +1 -0
- package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +36 -0
- package/android/detox/src/{full → main}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +1 -13
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +59 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +3 -15
- package/index.d.ts +208 -186
- package/index.js +1 -0
- package/internals.d.ts +129 -0
- package/internals.js +4 -0
- package/local-cli/build-framework-cache.js +2 -2
- package/local-cli/build.js +7 -8
- package/local-cli/build.test.js +46 -40
- package/local-cli/clean-framework-cache.js +3 -3
- package/local-cli/cli.js +0 -1
- package/local-cli/init.js +20 -55
- package/local-cli/templates/jest.js +9 -34
- package/local-cli/test.js +18 -282
- package/local-cli/test.test.js +332 -673
- package/local-cli/testCommand/TestRunnerCommand.js +156 -0
- package/local-cli/{utils/testCommandArgs.js → testCommand/builder.js} +10 -35
- package/local-cli/testCommand/middlewares.js +75 -0
- package/local-cli/{utils → testCommand}/warnings.js +0 -10
- package/local-cli/utils/jestInternals.js +13 -2
- package/local-cli/utils/yargsUtils.js +67 -0
- package/package.json +27 -21
- package/runners/deprecation.js +47 -0
- package/runners/jest/JestCircusEnvironment.js +3 -38
- package/runners/jest/adapter.d.ts +4 -10
- package/runners/jest/adapter.js +3 -6
- package/runners/jest/assignReporter.d.ts +4 -1
- package/runners/jest/assignReporter.js +3 -6
- package/runners/jest/deprecation.js +25 -0
- package/runners/jest/globalSetup.js +1 -0
- package/runners/jest/globalTeardown.js +1 -0
- package/runners/jest/index.js +21 -0
- package/runners/jest/reporter.js +1 -0
- package/runners/jest/reporters/DetoxReporter.js +5 -0
- package/runners/jest/specReporter.d.ts +4 -9
- package/runners/jest/specReporter.js +3 -10
- package/runners/jest/streamlineReporter.js +3 -22
- package/runners/jest/testEnvironment/index.js +155 -0
- package/runners/{jest-circus → jest/testEnvironment}/listeners/DetoxCoreListener.js +35 -17
- package/runners/{jest-circus → jest/testEnvironment}/listeners/DetoxInitErrorListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +27 -0
- package/runners/jest/{SpecReporterImpl.js → testEnvironment/listeners/SpecReporter.js} +61 -7
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +34 -0
- package/runners/jest/testEnvironment/listeners/index.js +13 -0
- package/runners/{jest-circus → jest/testEnvironment}/utils/assertExistingContext.js +2 -2
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +56 -0
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +23 -0
- package/runners/jest/{utils → testEnvironment/utils}/getFullTestName.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/hasTimedOut.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/index.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/stdout.js +0 -0
- package/runners/jest-circus/environment/index.js +6 -0
- package/runners/jest-circus/index.js +1 -10
- package/runners/jest-circus/reporter.js +1 -0
- package/runners/migration.js +37 -0
- package/runners/mocha/DetoxMochaAdapter.js +3 -35
- package/runners/mocha/adapter.d.ts +4 -7
- package/runners/mocha/adapter.js +3 -5
- package/src/{Detox.js → DetoxWorker.js} +130 -164
- package/src/artifacts/ArtifactsManager.js +51 -2
- package/src/artifacts/providers/index.js +0 -4
- package/src/artifacts/utils/buildDefaultArtifactsRootDirpath.js +2 -4
- package/src/artifacts/utils/temporaryPath.js +2 -0
- package/src/client/AsyncWebSocket.js +1 -1
- package/src/client/actions/actions.js +2 -2
- package/src/configuration/collectCliConfig.js +2 -4
- package/src/configuration/composeAppsConfig.js +8 -66
- package/src/configuration/composeArtifactsConfig.js +6 -32
- package/src/configuration/composeBehaviorConfig.js +3 -13
- package/src/configuration/composeDeviceConfig.js +37 -62
- package/src/configuration/composeLoggerConfig.js +50 -0
- package/src/configuration/composeRunnerConfig.js +74 -14
- package/src/configuration/composeSessionConfig.js +1 -3
- package/src/configuration/index.js +24 -23
- package/src/configuration/utils/deviceAppTypes.js +0 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +2 -6
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +1 -1
- package/src/devices/allocation/drivers/ios/SimulatorLauncher.js +3 -3
- package/src/devices/allocation/factories/index.js +0 -1
- package/src/devices/common/drivers/DeviceLauncher.js +2 -2
- package/src/devices/common/drivers/android/emulator/exec/EmulatorExec.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +4 -9
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +34 -9
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +1 -1
- package/src/devices/runtime/RuntimeDevice.js +69 -81
- package/src/devices/runtime/drivers/index.js +0 -1
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +3 -2
- package/src/devices/runtime/factories/ios.js +1 -8
- package/src/devices/runtime/utils/LaunchArgsEditor.js +4 -59
- package/src/devices/runtime/utils/Storage.js +4 -0
- package/src/environmentFactory.js +0 -8
- package/src/errors/DetoxConfigErrorComposer.js +76 -29
- package/src/errors/DetoxError.js +4 -0
- package/src/errors/DetoxRuntimeError.js +5 -5
- package/src/errors/index.js +2 -0
- package/src/ipc/IPCClient.js +117 -0
- package/src/ipc/IPCServer.js +81 -0
- package/src/ipc/state.js +67 -0
- package/src/logger/DetoxLogger.js +244 -0
- package/src/logger/DetoxTraceEventBuilder.js +21 -0
- package/src/logger/DetoxTracer.js +133 -0
- package/src/logger/TraceThreadDispatcher.js +52 -0
- package/src/{utils → logger}/customConsoleLogger.js +1 -1
- package/src/realms/DetoxConstants.js +13 -0
- package/src/realms/DetoxContext.js +170 -0
- package/src/realms/DetoxInternalsFacade.js +35 -0
- package/src/realms/DetoxPrimaryContext.js +228 -0
- package/src/realms/DetoxSecondaryContext.js +93 -0
- package/src/realms/index.js +10 -0
- package/src/realms/primary.js +3 -0
- package/src/realms/secondary.js +3 -0
- package/src/server/DetoxConnection.js +1 -1
- package/src/symbols.js +56 -0
- package/src/utils/Timer.js +14 -6
- package/{local-cli/utils/misc.js → src/utils/envUtils.js} +0 -9
- package/src/utils/logger.js +2 -162
- package/src/utils/shellUtils.js +18 -0
- package/src/utils/streamUtils.js +214 -0
- package/src/utils/trace.js +9 -44
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.aar +0 -0
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.0/detox-19.7.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -22
- package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +0 -75
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +0 -10
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +0 -39
- package/local-cli/templates/mocha.js +0 -32
- package/local-cli/utils/splitArgv.js +0 -107
- package/runners/integration.js +0 -16
- package/runners/jest/DetoxAdapterCircus.js +0 -60
- package/runners/jest/DetoxAdapterImpl.js +0 -81
- package/runners/jest/DetoxAdapterJasmine.js +0 -67
- package/runners/jest/DetoxStreamlineJestReporter.js +0 -98
- package/runners/jest/FailingTestsReporter.js +0 -16
- package/runners/jest/SpecReporterCircus.js +0 -51
- package/runners/jest/SpecReporterJasmine.js +0 -39
- package/runners/jest/WorkerAssignReporterCircus.js +0 -17
- package/runners/jest/WorkerAssignReporterImpl.js +0 -21
- package/runners/jest/WorkerAssignReporterJasmine.js +0 -15
- package/runners/jest/runnerInfo.js +0 -9
- package/runners/jest-circus/environment.js +0 -206
- package/runners/jest-circus/utils/assertJestCircus26.js +0 -39
- package/runners/jest-circus/utils/wrapErrorWithNoopLifecycle.js +0 -14
- package/src/DetoxConstants.js +0 -13
- package/src/DetoxExportWrapper.js +0 -140
- package/src/artifacts/timeline/TimelineArtifactPlugin.js +0 -90
- package/src/devices/allocation/drivers/NoneAllocDriver.js +0 -10
- package/src/devices/allocation/factories/none.js +0 -11
- package/src/index.js +0 -6
- package/src/utils/MissingDetox.js +0 -78
- package/src/utils/fakeTimestampsProvider.js +0 -9
- package/src/utils/getWorkerId.js +0 -5
- package/src/utils/lastFailedTests.js +0 -38
- package/src/utils/sh.js +0 -18
@@ -1,39 +0,0 @@
|
|
1
|
-
const fs = require('fs');
|
2
|
-
const path = require('path');
|
3
|
-
|
4
|
-
const DetoxRuntimeError = require('../../../src/errors/DetoxRuntimeError');
|
5
|
-
|
6
|
-
function assertJestCircus26(maybeProjectConfig) {
|
7
|
-
const projectConfig = maybeProjectConfig.projectConfig || maybeProjectConfig;
|
8
|
-
|
9
|
-
if (!/jest-circus/.test(projectConfig.testRunner)) {
|
10
|
-
throw new DetoxRuntimeError('Cannot run tests without "jest-circus" npm package, exiting.');
|
11
|
-
}
|
12
|
-
|
13
|
-
const circusPackageJson = path.join(path.dirname(projectConfig.testRunner), 'package.json');
|
14
|
-
if (!fs.existsSync(circusPackageJson)) {
|
15
|
-
throw new DetoxRuntimeError('Check that you have an installed copy of "jest-circus" npm package, exiting.');
|
16
|
-
}
|
17
|
-
|
18
|
-
const circusVersion = require(circusPackageJson).version || '';
|
19
|
-
const [major, minor, patch] = circusVersion.split('.');
|
20
|
-
if (major < 26) {
|
21
|
-
throw new DetoxRuntimeError(
|
22
|
-
`Cannot use older versions of "jest-circus", exiting.\n` +
|
23
|
-
`You have jest-circus@${circusVersion}. Update to ^26.0.0 or newer.`
|
24
|
-
);
|
25
|
-
}
|
26
|
-
|
27
|
-
if (major == 26 && minor == 5 && patch < 2) {
|
28
|
-
throw new DetoxRuntimeError(
|
29
|
-
`You have jest-circus@${circusVersion} currently installed.\n` +
|
30
|
-
`Unfortunately, it is incompatible with Detox due to this critical issue:\n\n` +
|
31
|
-
`https://github.com/wix/Detox/issues/2390\n\n` +
|
32
|
-
`Please update to jest-circus@^26.5.2 (or newer) to proceed.`
|
33
|
-
);
|
34
|
-
}
|
35
|
-
|
36
|
-
return maybeProjectConfig;
|
37
|
-
}
|
38
|
-
|
39
|
-
module.exports = assertJestCircus26;
|
@@ -1,14 +0,0 @@
|
|
1
|
-
const _ = require('lodash');
|
2
|
-
|
3
|
-
const lifecycleSymbols = require('../../integration').lifecycle;
|
4
|
-
|
5
|
-
function wrapErrorWithNoopLifecycle(error) {
|
6
|
-
const wrapper = { error };
|
7
|
-
for (const symbol of Object.values(lifecycleSymbols)) {
|
8
|
-
wrapper[symbol] = _.noop;
|
9
|
-
}
|
10
|
-
|
11
|
-
return wrapper;
|
12
|
-
}
|
13
|
-
|
14
|
-
module.exports = wrapErrorWithNoopLifecycle;
|
package/src/DetoxConstants.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module.exports = Object.freeze({
|
2
|
-
'userNotificationTriggers': {
|
3
|
-
'push': 'push',
|
4
|
-
'calendar': 'calendar',
|
5
|
-
'timeInterval': 'timeInterval',
|
6
|
-
'location': 'location'
|
7
|
-
},
|
8
|
-
'userActivityTypes': {
|
9
|
-
'searchableItem': 'com.apple.corespotlightitem',
|
10
|
-
'browsingWeb': 'NSUserActivityTypeBrowsingWeb',
|
11
|
-
},
|
12
|
-
'searchableItemActivityIdentifier': 'kCSSearchableItemActivityIdentifier'
|
13
|
-
});
|
@@ -1,140 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const funpermaproxy = require('funpermaproxy');
|
3
|
-
|
4
|
-
const Detox = require('./Detox');
|
5
|
-
const DetoxConstants = require('./DetoxConstants');
|
6
|
-
const configuration = require('./configuration');
|
7
|
-
const logger = require('./utils/logger');
|
8
|
-
const log = logger.child({ __filename });
|
9
|
-
const { trace, traceCall } = require('./utils/trace');
|
10
|
-
|
11
|
-
const _detox = Symbol('detox');
|
12
|
-
const _shouldLogInitError = Symbol('shouldLogInitError');
|
13
|
-
|
14
|
-
class DetoxExportWrapper {
|
15
|
-
constructor() {
|
16
|
-
this[_detox] = Detox.none;
|
17
|
-
this[_shouldLogInitError] = true;
|
18
|
-
|
19
|
-
this.init = this.init.bind(this);
|
20
|
-
this.cleanup = this.cleanup.bind(this);
|
21
|
-
|
22
|
-
this.DetoxConstants = DetoxConstants;
|
23
|
-
|
24
|
-
this._definePassthroughMethod('beforeEach');
|
25
|
-
this._definePassthroughMethod('afterEach');
|
26
|
-
this._definePassthroughMethod('suiteStart');
|
27
|
-
this._definePassthroughMethod('suiteEnd');
|
28
|
-
|
29
|
-
this._definePassthroughMethod('element');
|
30
|
-
this._definePassthroughMethod('expect');
|
31
|
-
this._definePassthroughMethod('waitFor');
|
32
|
-
|
33
|
-
this._defineProxy('by');
|
34
|
-
this._defineProxy('device');
|
35
|
-
this._defineProxy('web');
|
36
|
-
|
37
|
-
this.trace = trace;
|
38
|
-
this.traceCall = traceCall;
|
39
|
-
}
|
40
|
-
|
41
|
-
async init(configOverride, userParams) {
|
42
|
-
let configError, exposeGlobals, resolvedConfig;
|
43
|
-
|
44
|
-
trace.init();
|
45
|
-
logger.reinitialize(Detox.global);
|
46
|
-
|
47
|
-
try {
|
48
|
-
resolvedConfig = await configuration.composeDetoxConfig({
|
49
|
-
override: configOverride,
|
50
|
-
userParams,
|
51
|
-
});
|
52
|
-
|
53
|
-
exposeGlobals = resolvedConfig.behaviorConfig.init.exposeGlobals;
|
54
|
-
} catch (err) {
|
55
|
-
configError = err;
|
56
|
-
exposeGlobals = true;
|
57
|
-
}
|
58
|
-
|
59
|
-
try {
|
60
|
-
if (exposeGlobals) {
|
61
|
-
Detox.none.initContext(Detox.global);
|
62
|
-
}
|
63
|
-
|
64
|
-
if (configError) {
|
65
|
-
throw configError;
|
66
|
-
}
|
67
|
-
|
68
|
-
this[_detox] = new Detox(resolvedConfig);
|
69
|
-
await traceCall('detoxInit', () => this[_detox].init());
|
70
|
-
Detox.none.setError(null);
|
71
|
-
|
72
|
-
return this[_detox];
|
73
|
-
} catch (err) {
|
74
|
-
if (this[_shouldLogInitError]) {
|
75
|
-
log.error({ event: 'DETOX_INIT_ERROR' }, '\n', err);
|
76
|
-
}
|
77
|
-
|
78
|
-
Detox.none.setError(err);
|
79
|
-
throw err;
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
async cleanup() {
|
84
|
-
Detox.none.cleanupContext(Detox.global);
|
85
|
-
|
86
|
-
if (this[_detox] !== Detox.none) {
|
87
|
-
await this[_detox].cleanup();
|
88
|
-
this[_detox] = Detox.none;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
_definePassthroughMethod(name) {
|
93
|
-
this[name] = (...args) => {
|
94
|
-
return this[_detox][name](...args);
|
95
|
-
};
|
96
|
-
}
|
97
|
-
|
98
|
-
_defineProxy(name) {
|
99
|
-
this[name] = funpermaproxy(() => this[_detox][name]);
|
100
|
-
}
|
101
|
-
|
102
|
-
/** Use for test runners with sandboxed global */
|
103
|
-
_setGlobal(global) {
|
104
|
-
Detox.global = global;
|
105
|
-
return this;
|
106
|
-
}
|
107
|
-
|
108
|
-
/** @internal */
|
109
|
-
_suppressLoggingInitErrors() {
|
110
|
-
this[_shouldLogInitError] = false;
|
111
|
-
return this;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
DetoxExportWrapper.prototype.hook = configuration.hook;
|
116
|
-
|
117
|
-
DetoxExportWrapper.prototype.globalInit = async function() {
|
118
|
-
try {
|
119
|
-
// TODO This can only work in Jest, where config info etc. is available globally through env vars rather
|
120
|
-
// than argv (e.g. in Mocha) -- which we don't have available here.
|
121
|
-
// We will resolve this, ultimately, in https://github.com/wix/Detox/issues/2894 (DAS project), where
|
122
|
-
// this whole hack would be removed altogether.
|
123
|
-
const configs = await configuration.composeDetoxConfig({});
|
124
|
-
await Detox.globalInit(configs);
|
125
|
-
} catch (error) {
|
126
|
-
log.warn({ event: 'GLOBAL_INIT' }, 'An error occurred!');
|
127
|
-
throw error;
|
128
|
-
}
|
129
|
-
};
|
130
|
-
|
131
|
-
DetoxExportWrapper.prototype.globalCleanup = async function() {
|
132
|
-
try {
|
133
|
-
const configs = await configuration.composeDetoxConfig({});
|
134
|
-
await Detox.globalCleanup(configs);
|
135
|
-
} catch (error) {
|
136
|
-
log.warn({ event: 'GLOBAL_CLEANUP' }, 'An error occurred!', error);
|
137
|
-
}
|
138
|
-
};
|
139
|
-
|
140
|
-
module.exports = DetoxExportWrapper;
|
@@ -1,90 +0,0 @@
|
|
1
|
-
const fs = require('fs-extra');
|
2
|
-
const _noop = require('lodash/noop');
|
3
|
-
|
4
|
-
const ChromeTracingExporter = require('../../utils/ChromeTracingExporter');
|
5
|
-
const fakeTimestampsProvider = require('../../utils/fakeTimestampsProvider');
|
6
|
-
const { trace } = require('../../utils/trace');
|
7
|
-
const FileArtifact = require('../templates/artifact/FileArtifact');
|
8
|
-
const ArtifactPlugin = require('../templates/plugin/ArtifactPlugin');
|
9
|
-
|
10
|
-
const traceNoop = {
|
11
|
-
startSection: _noop,
|
12
|
-
endSection: _noop,
|
13
|
-
};
|
14
|
-
|
15
|
-
class TimelineArtifactPlugin extends ArtifactPlugin {
|
16
|
-
constructor(config) {
|
17
|
-
super(config);
|
18
|
-
this._useFakeTimestamps = config.useFakeTimestamps;
|
19
|
-
|
20
|
-
const threadId = process.env.JEST_WORKER_ID || process.pid;
|
21
|
-
this._trace = this.enabled ? trace : traceNoop;
|
22
|
-
this._traceExporter = new ChromeTracingExporter({
|
23
|
-
process: { id: 0, name: 'detox' },
|
24
|
-
thread: { id: threadId, name: `Worker #${threadId}` },
|
25
|
-
});
|
26
|
-
}
|
27
|
-
|
28
|
-
async onBootDevice(event) {
|
29
|
-
this._deviceName = event.deviceId;
|
30
|
-
return super.onBootDevice(event);
|
31
|
-
}
|
32
|
-
|
33
|
-
async onRunDescribeStart(suite) {
|
34
|
-
const sectionName = (suite.name === 'ROOT_DESCRIBE_BLOCK' ? this._deviceName : suite.name);
|
35
|
-
this._trace.startSection(sectionName);
|
36
|
-
await super.onRunDescribeStart(suite);
|
37
|
-
}
|
38
|
-
|
39
|
-
async onRunDescribeFinish(suite) {
|
40
|
-
const sectionName = (suite.name === 'ROOT_DESCRIBE_BLOCK' ? this._deviceName : suite.name);
|
41
|
-
this._trace.endSection(sectionName);
|
42
|
-
await super.onRunDescribeFinish(suite);
|
43
|
-
}
|
44
|
-
|
45
|
-
async onTestStart(testSummary) {
|
46
|
-
this._trace.startSection(testSummary.title);
|
47
|
-
await super.onTestStart(testSummary);
|
48
|
-
}
|
49
|
-
|
50
|
-
async onTestDone(testSummary) {
|
51
|
-
this._trace.endSection(testSummary.title, { status: testSummary.status });
|
52
|
-
await super.onTestDone(testSummary);
|
53
|
-
}
|
54
|
-
|
55
|
-
async onBeforeCleanup() {
|
56
|
-
this._deviceName = null;
|
57
|
-
|
58
|
-
if (!this.enabled) {
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
|
62
|
-
const traceLogPath = await this.api.preparePathForArtifact(`detox.trace.json`);
|
63
|
-
const append = await this._logFileExists(traceLogPath);
|
64
|
-
const events = this._useFakeTimestamps ? this._transformEventTimestamps(trace.events) : trace.events;
|
65
|
-
const data = this._traceExporter.export(events, append);
|
66
|
-
|
67
|
-
const fileArtifact = new FileArtifact({ temporaryData: data });
|
68
|
-
await fileArtifact.save(traceLogPath, { append });
|
69
|
-
}
|
70
|
-
|
71
|
-
async _logFileExists(traceLogPath) {
|
72
|
-
return fs.access(traceLogPath).then(() => true).catch(() => false);
|
73
|
-
}
|
74
|
-
|
75
|
-
_transformEventTimestamps(events) {
|
76
|
-
return events.map((event) => ({
|
77
|
-
...event,
|
78
|
-
ts: fakeTimestampsProvider(),
|
79
|
-
}));
|
80
|
-
}
|
81
|
-
|
82
|
-
/** @param {string} config */
|
83
|
-
static parseConfig(config) {
|
84
|
-
return {
|
85
|
-
enabled: config === 'all',
|
86
|
-
};
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
module.exports = TimelineArtifactPlugin;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
const AllocationDriverBase = require('./AllocationDriverBase');
|
2
|
-
|
3
|
-
class NoneAllocDriver extends AllocationDriverBase {
|
4
|
-
async allocate(deviceQuery) { // eslint-disable-line no-unused-vars
|
5
|
-
return null;
|
6
|
-
}
|
7
|
-
async free(cookie, options) {} // eslint-disable-line no-unused-vars
|
8
|
-
}
|
9
|
-
|
10
|
-
module.exports = NoneAllocDriver;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const DeviceAllocatorFactory = require('./base');
|
3
|
-
|
4
|
-
class None extends DeviceAllocatorFactory {
|
5
|
-
_createDriver() {
|
6
|
-
const NoneAllocDriver = require('../drivers/NoneAllocDriver');
|
7
|
-
return new NoneAllocDriver();
|
8
|
-
}
|
9
|
-
}
|
10
|
-
|
11
|
-
module.exports = { None };
|
package/src/index.js
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
const DetoxRuntimeError = require('../errors/DetoxRuntimeError');
|
2
|
-
|
3
|
-
class MissingDetox {
|
4
|
-
constructor() {
|
5
|
-
this.throwError = this.throwError.bind(this);
|
6
|
-
this.initContext(this);
|
7
|
-
|
8
|
-
this._defineRequiredProperty(this, 'beforeEach', async () => this.throwError(), true);
|
9
|
-
this._defineRequiredProperty(this, 'afterEach', async () => this.throwError(), true);
|
10
|
-
}
|
11
|
-
|
12
|
-
initContext(context) {
|
13
|
-
const readonly = context === this;
|
14
|
-
|
15
|
-
this._defineRequiredProperty(context, 'by', undefined, readonly);
|
16
|
-
this._defineRequiredProperty(context, 'device', undefined, readonly);
|
17
|
-
this._defineRequiredProperty(context, 'element', this.throwError, readonly);
|
18
|
-
this._defineRequiredProperty(context, 'expect', this.throwError, readonly);
|
19
|
-
this._defineRequiredProperty(context, 'waitFor', this.throwError, readonly);
|
20
|
-
this._defineRequiredProperty(context, 'web', undefined, readonly);
|
21
|
-
}
|
22
|
-
|
23
|
-
cleanupContext(context) {
|
24
|
-
this._cleanupProperty(context, 'by');
|
25
|
-
this._cleanupProperty(context, 'device');
|
26
|
-
this._cleanupProperty(context, 'element');
|
27
|
-
this._cleanupProperty(context, 'expect');
|
28
|
-
this._cleanupProperty(context, 'waitFor');
|
29
|
-
}
|
30
|
-
|
31
|
-
_cleanupProperty(context, name) {
|
32
|
-
if (context.hasOwnProperty(name)) {
|
33
|
-
context[name] = undefined;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
_defineRequiredProperty(context, name, initialValue, readonly) {
|
38
|
-
if (context.hasOwnProperty(name)) {
|
39
|
-
return;
|
40
|
-
}
|
41
|
-
|
42
|
-
let _value = initialValue;
|
43
|
-
|
44
|
-
const descriptor = {
|
45
|
-
get: () => {
|
46
|
-
if (_value === undefined) {
|
47
|
-
this.throwError();
|
48
|
-
}
|
49
|
-
|
50
|
-
return _value;
|
51
|
-
},
|
52
|
-
};
|
53
|
-
|
54
|
-
if (!readonly) {
|
55
|
-
descriptor.set = (value) => {
|
56
|
-
_value = value;
|
57
|
-
};
|
58
|
-
}
|
59
|
-
|
60
|
-
Object.defineProperty(context, name, descriptor);
|
61
|
-
}
|
62
|
-
|
63
|
-
setError(err) {
|
64
|
-
this._lastError = err;
|
65
|
-
}
|
66
|
-
|
67
|
-
throwError() {
|
68
|
-
throw new DetoxRuntimeError({
|
69
|
-
message: 'Detox instance has not been initialized',
|
70
|
-
hint: this._lastError
|
71
|
-
? 'There was an error on attempt to call detox.init()'
|
72
|
-
: 'Make sure to call detox.init() before your test begins',
|
73
|
-
debugInfo: this._lastError && this._lastError.stack || '',
|
74
|
-
});
|
75
|
-
}
|
76
|
-
}
|
77
|
-
|
78
|
-
module.exports = MissingDetox;
|
package/src/utils/getWorkerId.js
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
const fs = require('fs-extra');
|
2
|
-
|
3
|
-
const environment = require('./environment');
|
4
|
-
|
5
|
-
async function resetLastFailedTests() {
|
6
|
-
const lastFailedTxt = environment.getLastFailedTestsPath();
|
7
|
-
await fs.remove(lastFailedTxt);
|
8
|
-
}
|
9
|
-
|
10
|
-
async function loadLastFailedTests() {
|
11
|
-
const lastFailedTxt = environment.getLastFailedTestsPath();
|
12
|
-
const lastFailedTests = await fs.exists(lastFailedTxt)
|
13
|
-
? (await fs.readFile(lastFailedTxt, 'utf8')).trim()
|
14
|
-
: '';
|
15
|
-
|
16
|
-
if (lastFailedTests) {
|
17
|
-
return lastFailedTests.split('\n');
|
18
|
-
} else {
|
19
|
-
return [];
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
/**
|
24
|
-
* @async
|
25
|
-
* @param {string[]} failedFiles - paths to the test suites
|
26
|
-
*/
|
27
|
-
async function saveLastFailedTests(failedFiles) {
|
28
|
-
const failedTestsPath = environment.getLastFailedTestsPath();
|
29
|
-
|
30
|
-
await fs.ensureFile(failedTestsPath);
|
31
|
-
await fs.writeFile(failedTestsPath, failedFiles.join('\n'));
|
32
|
-
}
|
33
|
-
|
34
|
-
module.exports = {
|
35
|
-
resetLastFailedTests,
|
36
|
-
loadLastFailedTests,
|
37
|
-
saveLastFailedTests,
|
38
|
-
};
|
package/src/utils/sh.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const cpp = require('child-process-promise');
|
3
|
-
|
4
|
-
const sh = new Proxy({}, {
|
5
|
-
get: function(target, prop) {
|
6
|
-
if (target[prop] === undefined) {
|
7
|
-
return target[prop] = (...params) => {
|
8
|
-
return cpp.exec(`${prop} ${params.join(' ')}`);
|
9
|
-
};
|
10
|
-
} else {
|
11
|
-
return target[prop];
|
12
|
-
}
|
13
|
-
}
|
14
|
-
});
|
15
|
-
|
16
|
-
process.env['PATH'] = `${process.env.PATH}:${sh.npm(`bin`)}`;
|
17
|
-
|
18
|
-
module.exports = sh;
|