detox 19.13.0 → 20.0.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.13.0/detox-19.13.0-javadoc.jar → 20.0.0/detox-20.0.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0-sources.jar → 20.0.0/detox-20.0.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.13.0/detox-19.13.0.pom → 20.0.0/detox-20.0.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.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/README.md +1 -1
- 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/index.d.ts +354 -191
- package/index.js +1 -0
- package/internals.d.ts +298 -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 +8 -7
- package/local-cli/init.js +73 -68
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/templates/jest.js +14 -36
- package/local-cli/test.js +24 -282
- package/local-cli/test.test.js +394 -648
- package/local-cli/testCommand/TestRunnerCommand.js +163 -0
- package/local-cli/{utils/testCommandArgs.js → testCommand/builder.js} +10 -36
- package/local-cli/testCommand/middlewares.js +66 -0
- package/local-cli/{utils → testCommand}/warnings.js +0 -13
- package/local-cli/utils/jestInternals.js +13 -2
- package/local-cli/utils/yargsUtils.js +67 -0
- package/package.json +32 -19
- package/runners/deprecation.js +45 -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/globalSetup.js +1 -0
- package/runners/jest/globalTeardown.js +1 -0
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +16 -0
- package/runners/jest/index.test.js +13 -0
- package/runners/jest/reporter.js +1 -0
- package/runners/jest/reporters/DetoxReporter.js +36 -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 +205 -0
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +166 -0
- 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 -9
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +30 -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 +70 -0
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +22 -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/DetoxWorker.js +327 -0
- package/src/android/interactions/native.js +2 -1
- package/src/artifacts/ArtifactsManager.js +51 -35
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/providers/index.js +0 -4
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
- package/src/artifacts/templates/artifact/Artifact.js +1 -1
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/utils/buildDefaultArtifactsRootDirpath.js +2 -4
- package/src/artifacts/utils/temporaryPath.js +18 -5
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +1 -1
- package/src/client/actions/actions.js +2 -2
- package/src/configuration/collectCliConfig.js +3 -16
- package/src/configuration/composeAppsConfig.js +12 -66
- package/src/configuration/composeArtifactsConfig.js +6 -32
- package/src/configuration/composeBehaviorConfig.js +3 -13
- package/src/configuration/composeDeviceConfig.js +38 -63
- package/src/configuration/composeLoggerConfig.js +59 -0
- package/src/configuration/composeRunnerConfig.js +127 -14
- package/src/configuration/composeSessionConfig.js +1 -3
- package/src/configuration/index.js +36 -30
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/configuration/utils/deviceAppTypes.js +0 -1
- package/src/devices/allocation/DeviceAllocator.js +4 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +5 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- 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/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
- package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +35 -10
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +85 -86
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +3 -3
- package/src/devices/runtime/drivers/index.js +0 -1
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +4 -3
- 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 +92 -30
- package/src/errors/DetoxError.js +4 -0
- package/src/errors/DetoxRuntimeError.js +5 -5
- package/src/errors/index.js +2 -0
- package/src/ios/expectTwo.js +2 -1
- package/src/ipc/IPCClient.js +117 -0
- package/src/ipc/IPCServer.js +98 -0
- package/src/ipc/SessionState.js +62 -0
- package/src/logger/DetoxLogger.js +348 -0
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +76 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +36 -0
- package/src/logger/utils/DetoxLogFinalizer.js +140 -0
- package/src/logger/utils/MessageStack.js +24 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/{utils → logger/utils}/customConsoleLogger.js +5 -4
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/logger/utils/streamUtils.js +248 -0
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxConstants.js +13 -0
- package/src/realms/DetoxContext.js +183 -0
- package/src/realms/DetoxInternalsFacade.js +31 -0
- package/src/realms/DetoxPrimaryContext.js +261 -0
- package/src/realms/DetoxSecondaryContext.js +91 -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 +18 -23
- package/src/server/DetoxServer.js +7 -10
- package/src/server/DetoxSession.js +6 -6
- package/src/server/DetoxSessionManager.js +1 -1
- package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
- package/src/symbols.js +50 -0
- package/src/utils/Timer.js +58 -33
- package/src/utils/argparse.js +11 -0
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/{local-cli/utils/misc.js → src/utils/envUtils.js} +0 -9
- package/src/utils/errorUtils.js +20 -0
- package/src/utils/logger.js +2 -162
- package/src/utils/shellUtils.js +18 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar +0 -0
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.13.0/detox-19.13.0.pom.sha512 +0 -1
- 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/listeners/DetoxCoreListener.js +0 -113
- package/runners/jest-circus/utils/assertJestCircus26.js +0 -39
- package/runners/jest-circus/utils/wrapErrorWithNoopLifecycle.js +0 -14
- package/src/Detox.js +0 -317
- package/src/DetoxConstants.js +0 -13
- package/src/DetoxExportWrapper.js +0 -140
- package/src/artifacts/timeline/TimelineArtifactPlugin.js +0 -92
- package/src/configuration/utils/warnings.js +0 -12
- 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/ChromeTracingExporter.js +0 -54
- 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
- package/src/utils/trace.js +0 -96
@@ -0,0 +1,27 @@
|
|
1
|
+
const _ = require('lodash');
|
2
|
+
|
3
|
+
const { device } = require('../../../..');
|
4
|
+
|
5
|
+
const PLATFORM_REGEXP = /^:([^:]+):/;
|
6
|
+
|
7
|
+
class DetoxPlatformFilterListener {
|
8
|
+
setup() {
|
9
|
+
this._platform = device.getPlatform();
|
10
|
+
}
|
11
|
+
|
12
|
+
start_describe_definition(event, state) {
|
13
|
+
const match = event.blockName.match(PLATFORM_REGEXP);
|
14
|
+
if (match && match[1] !== this._platform) {
|
15
|
+
state.currentDescribeBlock.mode = 'skip';
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
add_test(event, state) {
|
20
|
+
const match = event.testName.match(PLATFORM_REGEXP);
|
21
|
+
if (match && match[1] !== this._platform) {
|
22
|
+
_.last(state.currentDescribeBlock.children).mode = 'skip';
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
module.exports = DetoxPlatformFilterListener;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
const chalk = require('chalk').default;
|
2
|
+
const noop = require('lodash/noop');
|
2
3
|
|
3
|
-
const log = require('
|
4
|
-
|
5
|
-
const { traceln } = require('./utils/stdout');
|
4
|
+
const { config, log, session } = require('../../../../internals');
|
5
|
+
const { traceln } = require('../utils/stdout');
|
6
6
|
|
7
7
|
const RESULT_SKIPPED = chalk.yellow('SKIPPED');
|
8
8
|
const RESULT_FAILED = chalk.red('FAIL');
|
@@ -16,12 +16,64 @@ class SpecReporter {
|
|
16
16
|
this._suitesDesc = '';
|
17
17
|
}
|
18
18
|
|
19
|
-
|
19
|
+
setup() {
|
20
|
+
const jestSection = config.testRunner.jest;
|
21
|
+
const reportSpecs = jestSection && jestSection.reportSpecs;
|
22
|
+
const enabled = reportSpecs !== undefined ? reportSpecs : session.workersCount === 1;
|
23
|
+
|
24
|
+
if (!enabled) {
|
25
|
+
this.run_describe_start = noop;
|
26
|
+
this.run_describe_finish = noop;
|
27
|
+
this.test_start = noop;
|
28
|
+
this.test_done = noop;
|
29
|
+
this.test_skip = noop;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
run_describe_start(event) {
|
34
|
+
if (event.describeBlock.parent !== undefined) {
|
35
|
+
this._onSuiteStart({
|
36
|
+
description: event.describeBlock.name,
|
37
|
+
});
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
run_describe_finish(event) {
|
42
|
+
if (event.describeBlock.parent !== undefined) {
|
43
|
+
this._onSuiteEnd();
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
test_start(event) {
|
48
|
+
const { test } = event;
|
49
|
+
this._onTestStart({
|
50
|
+
description: test.name,
|
51
|
+
invocations: test.invocations,
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
55
|
+
test_done(event) {
|
56
|
+
const { test } = event;
|
57
|
+
const testInfo = {
|
58
|
+
description: test.name,
|
59
|
+
invocations: test.invocations,
|
60
|
+
};
|
61
|
+
this._onTestEnd(testInfo, test.errors.length ? 'failed' : 'success');
|
62
|
+
}
|
63
|
+
|
64
|
+
test_skip(event) {
|
65
|
+
const testInfo = {
|
66
|
+
description: event.test.name,
|
67
|
+
};
|
68
|
+
this._onTestEnd(testInfo, 'skipped');
|
69
|
+
}
|
70
|
+
|
71
|
+
_onSuiteStart({ description }) {
|
20
72
|
this._suites.push({ description });
|
21
73
|
this._regenerateSuitesDesc();
|
22
74
|
}
|
23
75
|
|
24
|
-
|
76
|
+
_onSuiteEnd() {
|
25
77
|
this._suites.pop();
|
26
78
|
this._regenerateSuitesDesc();
|
27
79
|
|
@@ -30,11 +82,11 @@ class SpecReporter {
|
|
30
82
|
}
|
31
83
|
}
|
32
84
|
|
33
|
-
|
85
|
+
_onTestStart({ description, invocations = 1 }) {
|
34
86
|
this._traceTest({ description, invocations });
|
35
87
|
}
|
36
88
|
|
37
|
-
|
89
|
+
_onTestEnd({ description, invocations = 1 }, result) {
|
38
90
|
let status;
|
39
91
|
switch (result) {
|
40
92
|
case 'skipped': status = RESULT_SKIPPED; break;
|
@@ -56,7 +108,7 @@ class SpecReporter {
|
|
56
108
|
.concat(suite.description)
|
57
109
|
.concat((index === total - 1) ? ': ' : '');
|
58
110
|
});
|
59
|
-
this._suitesDesc = chalk.bold
|
111
|
+
this._suitesDesc = chalk.bold(this._suitesDesc);
|
60
112
|
}
|
61
113
|
|
62
114
|
_traceTest({ description, invocations }, _status = undefined) {
|
@@ -64,7 +116,7 @@ class SpecReporter {
|
|
64
116
|
const retriesDescription = (invocations > 1) ? chalk.gray(` [Retry #${invocations - 1}]`) : '';
|
65
117
|
const status = chalk.gray(_status ? ` [${_status}]` : '');
|
66
118
|
const desc = this._suitesDesc + testDescription + retriesDescription + status;
|
67
|
-
log.info({
|
119
|
+
log.info({ cat: 'lifecycle' }, desc);
|
68
120
|
}
|
69
121
|
}
|
70
122
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
3
|
+
const chalk = require('chalk').default;
|
4
|
+
const _ = require('lodash');
|
5
|
+
|
6
|
+
const { device } = require('../../../..');
|
7
|
+
const { config, log } = require('../../../../internals');
|
8
|
+
|
9
|
+
class WorkerAssignReporter {
|
10
|
+
constructor({ env }) {
|
11
|
+
this._testName = path.basename(env.testPath);
|
12
|
+
}
|
13
|
+
|
14
|
+
run_start() {
|
15
|
+
if (config.testRunner.jest.reportWorkerAssign) {
|
16
|
+
log.info({ cat: 'lifecycle' }, `${chalk.bold(this._testName)} is assigned to ${this._formatDeviceName()}`);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
_formatDeviceName() {
|
21
|
+
const deviceName = _.attempt(() => device.name);
|
22
|
+
const formattedDeviceName = _.isError(deviceName)
|
23
|
+
? chalk.redBright('undefined')
|
24
|
+
: chalk.blueBright(deviceName);
|
25
|
+
|
26
|
+
return formattedDeviceName;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
module.exports = WorkerAssignReporter;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
const DetoxCoreListener = require('./DetoxCoreListener');
|
2
|
+
const DetoxInitErrorListener = require('./DetoxInitErrorListener');
|
3
|
+
const DetoxPlatformFilterListener = require('./DetoxPlatformFilterListener');
|
4
|
+
const SpecReporter = require('./SpecReporter');
|
5
|
+
const WorkerAssignReporter = require('./WorkerAssignReporter');
|
6
|
+
|
7
|
+
module.exports = {
|
8
|
+
DetoxCoreListener,
|
9
|
+
DetoxInitErrorListener,
|
10
|
+
DetoxPlatformFilterListener,
|
11
|
+
SpecReporter,
|
12
|
+
WorkerAssignReporter,
|
13
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
// @ts-nocheck
|
2
|
-
const { DetoxRuntimeError } = require('
|
3
|
-
const { filterErrorStack } = require('
|
2
|
+
const { DetoxRuntimeError } = require('../../../../src/errors/DetoxRuntimeError');
|
3
|
+
const { filterErrorStack } = require('../../../../src/utils/errorUtils');
|
4
4
|
|
5
5
|
function findUserConstructor() {
|
6
6
|
let wasInBaseClass = false;
|
@@ -0,0 +1,70 @@
|
|
1
|
+
const fs = require('fs');
|
2
|
+
const path = require('path');
|
3
|
+
|
4
|
+
const resolveFrom = require('resolve-from');
|
5
|
+
const semver = require('semver');
|
6
|
+
|
7
|
+
const { log } = require('../../../../internals');
|
8
|
+
const detoxPackageJson = require('../../../../package.json');
|
9
|
+
const { DetoxRuntimeError } = require('../../../../src/errors');
|
10
|
+
|
11
|
+
function assertJestCircus27(maybeProjectConfig) {
|
12
|
+
const projectConfig = maybeProjectConfig.projectConfig || maybeProjectConfig;
|
13
|
+
|
14
|
+
if (!/jest-circus/.test(projectConfig.testRunner)) {
|
15
|
+
throw new DetoxRuntimeError({
|
16
|
+
message: 'Cannot continue without Jest Circus test runner underneath, exiting.',
|
17
|
+
hint: 'Make sure that in your Jest config you have no "testRunner" property or it is explicitly set to "jest-circus/runner".',
|
18
|
+
debugInfo: `The test runner powering your configuration is:\n${projectConfig.testRunner}`,
|
19
|
+
});
|
20
|
+
}
|
21
|
+
|
22
|
+
const circusPackageJson = path.join(path.dirname(projectConfig.testRunner), 'package.json');
|
23
|
+
if (!fs.existsSync(circusPackageJson)) {
|
24
|
+
throw new DetoxRuntimeError({
|
25
|
+
message: 'Check that you have an installed copy of "jest-circus" npm package, exiting.',
|
26
|
+
debugInfo: `Its package.json file is missing: ${circusPackageJson}`,
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
const jestManifestPath = resolveFrom(process.cwd(), 'jest/package.json');
|
31
|
+
const jestManifest = require(jestManifestPath);
|
32
|
+
assertSupportedVersion(jestManifest.version);
|
33
|
+
|
34
|
+
const circusVersion = require(circusPackageJson).version;
|
35
|
+
if (!circusVersion) {
|
36
|
+
throw new DetoxRuntimeError({
|
37
|
+
message: 'Check that you have an valid copy of "jest-circus" npm package, exiting.',
|
38
|
+
debugInfo: `Its package.json file has no "version" property. See:\n` + circusPackageJson,
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
if (jestManifest.version !== circusVersion) {
|
43
|
+
log.warn([
|
44
|
+
`jest-circus@${circusVersion} does not match jest@${jestManifest.version}.\n`,
|
45
|
+
`- jest@${jestManifest.version} resolved path:\n\t${jestManifestPath}`,
|
46
|
+
`- jest-circus@${circusVersion} resolved path:\n\t${circusPackageJson}`,
|
47
|
+
`\nPlease make sure that your versions match to avoid unexpected behavior!`,
|
48
|
+
].join('\n'));
|
49
|
+
}
|
50
|
+
|
51
|
+
return maybeProjectConfig;
|
52
|
+
}
|
53
|
+
|
54
|
+
function assertSupportedVersion(actualVersion) {
|
55
|
+
const supportedRange = detoxPackageJson.peerDependencies.jest;
|
56
|
+
const minSupportedVersion = semver.minVersion(supportedRange);
|
57
|
+
const action = semver.lt(actualVersion, minSupportedVersion) ? 'upgrade' : 'downgrade';
|
58
|
+
|
59
|
+
if (!semver.satisfies(actualVersion, supportedRange, { includePrerelease: true })) {
|
60
|
+
throw new DetoxRuntimeError({
|
61
|
+
message: `Detected an unsupported jest@${actualVersion} version.`,
|
62
|
+
hint: `Please ${action} your Jest test runner to the supported range: ${supportedRange}.`
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
module.exports = {
|
68
|
+
assertJestCircus27,
|
69
|
+
assertSupportedVersion,
|
70
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
const { assertSupportedVersion } = require('./assertJestCircus27');
|
2
|
+
|
3
|
+
describe('assertSupportedVersion', () => {
|
4
|
+
test.each([
|
5
|
+
['27.2.5'],
|
6
|
+
['27.2.6-prerelease.0'],
|
7
|
+
['27.3.0'],
|
8
|
+
['28.0.0-alpha.1'],
|
9
|
+
['28.0.0'],
|
10
|
+
['28.1.0'],
|
11
|
+
['29.0.0-next.0'],
|
12
|
+
])('should pass for %j', (version) => {
|
13
|
+
expect(() => assertSupportedVersion(version)).not.toThrow();
|
14
|
+
});
|
15
|
+
|
16
|
+
test.each([
|
17
|
+
['26.0.0'],
|
18
|
+
['27.2.4'],
|
19
|
+
])('should throw an error for %j', (version) => {
|
20
|
+
expect(() => assertSupportedVersion(version)).toThrowError(/unsupported jest.*version/);
|
21
|
+
});
|
22
|
+
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,10 +1 @@
|
|
1
|
-
|
2
|
-
const WorkerAssignReporterCircus = require('../jest/WorkerAssignReporterCircus');
|
3
|
-
|
4
|
-
const DetoxCircusEnvironment = require('./environment');
|
5
|
-
|
6
|
-
module.exports = {
|
7
|
-
DetoxCircusEnvironment,
|
8
|
-
SpecReporter: SpecReporterCircus,
|
9
|
-
WorkerAssignReporter: WorkerAssignReporterCircus,
|
10
|
-
};
|
1
|
+
module.exports = require('../migration')(__filename);
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('../migration')(__filename);
|
@@ -0,0 +1,37 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
3
|
+
const chalk = require('chalk');
|
4
|
+
const _ = require('lodash');
|
5
|
+
|
6
|
+
const SEARCH_VALUE = ['', 'detox', 'runners', 'jest-circus', ''].join(path.sep);
|
7
|
+
const REPLACE_VALUE = ['', 'detox', 'runners', 'jest', ''].join(path.sep);
|
8
|
+
|
9
|
+
function jsify(pathToFile) {
|
10
|
+
return 'detox/' + path
|
11
|
+
.relative(
|
12
|
+
path.join(__dirname, '..'),
|
13
|
+
pathToFile
|
14
|
+
)
|
15
|
+
.replace(/\\/g, '/')
|
16
|
+
.replace(/(?:\/index)?\.js$/, '');
|
17
|
+
}
|
18
|
+
|
19
|
+
const redirectWithWarning = _.memoize((
|
20
|
+
oldPath,
|
21
|
+
newPath = oldPath.replace(SEARCH_VALUE, REPLACE_VALUE)
|
22
|
+
) => {
|
23
|
+
redirectWithWarning._log([
|
24
|
+
'[DEPRECATION] Detox detected an attempt to require a module from an outdated location, please change in your project:',
|
25
|
+
`- ${jsify(oldPath)}`,
|
26
|
+
`+ ${jsify(newPath)}`,
|
27
|
+
'',
|
28
|
+
].join('\n'));
|
29
|
+
|
30
|
+
return require(newPath);
|
31
|
+
});
|
32
|
+
|
33
|
+
// @ts-ignore
|
34
|
+
// istanbul ignore next
|
35
|
+
redirectWithWarning._log = msg => process.stderr.write(chalk.yellow(msg) + '\n');
|
36
|
+
|
37
|
+
module.exports = redirectWithWarning;
|
@@ -1,35 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
}
|
5
|
-
|
6
|
-
async beforeEach(context) {
|
7
|
-
await this.detox.beforeEach({
|
8
|
-
title: context.currentTest.title,
|
9
|
-
fullName: context.currentTest.fullTitle(),
|
10
|
-
status: this._mapStatus(context, false),
|
11
|
-
});
|
12
|
-
}
|
13
|
-
|
14
|
-
async afterEach(context) {
|
15
|
-
await this.detox.afterEach({
|
16
|
-
title: context.currentTest.title,
|
17
|
-
fullName: context.currentTest.fullTitle(),
|
18
|
-
status: this._mapStatus(context, true),
|
19
|
-
timedOut: context.currentTest.timedOut,
|
20
|
-
});
|
21
|
-
}
|
22
|
-
|
23
|
-
_mapStatus(context, isAfterTest) {
|
24
|
-
switch (context.currentTest.state) {
|
25
|
-
case 'passed':
|
26
|
-
return 'passed';
|
27
|
-
case 'failed':
|
28
|
-
return 'failed';
|
29
|
-
default:
|
30
|
-
return isAfterTest ? 'failed' : 'running';
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
module.exports = DetoxMochaAdapter;
|
1
|
+
/** @deprecated */
|
2
|
+
/** @type {never} */
|
3
|
+
module.exports = require('../deprecation');
|
@@ -1,9 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
}
|
6
|
-
|
7
|
-
declare const adapter: DetoxMochaAdapter;
|
1
|
+
/**
|
2
|
+
* @deprecated Mocha integration is no longer supported since Detox v20.0.0
|
3
|
+
*/
|
4
|
+
declare const adapter: never;
|
8
5
|
|
9
6
|
export = adapter;
|
package/runners/mocha/adapter.js
CHANGED