detox 19.9.0 → 21.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.9.0/detox-19.9.0-javadoc.jar → 21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.9.0/detox-19.9.0-sources.jar → 21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.9.0/detox-19.9.0.pom → 21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom} +2 -2
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.0.0-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/21.0.0-breaking.new-global-lifecycle.0/detox-21.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/build.gradle +2 -2
- package/android/detox/build.gradle +2 -2
- package/android/detox/publish-pom.gradle +1 -5
- package/android/detox/publishing.gradle +7 -9
- 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/adapters/server/WebSocketClient.java +1 -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/UiAutomatorHelper.java +1 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +23 -16
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeLoadingMonitor.kt +8 -54
- package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +1 -4
- package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +1 -2
- 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/main/java/com/wix/detox/espresso/action/common/utils/UiControllerUtils.kt +1 -1
- 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/android/gradle/wrapper/gradle-wrapper.properties +1 -2
- package/android/gradlew +107 -181
- package/index.d.ts +208 -186
- package/index.js +1 -0
- package/internals.d.ts +124 -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 +157 -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 +28 -22
- 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} +131 -164
- package/src/artifacts/ArtifactsManager.js +51 -2
- package/src/artifacts/log/android/ADBLogcatRecording.js +28 -11
- 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 +9 -67
- 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/android/genycloud/GenyAllocDriver.js +0 -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/exec/ADB.js +0 -5
- 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 +87 -0
- package/src/ipc/state.js +76 -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 +229 -0
- package/src/realms/DetoxSecondaryContext.js +94 -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/ChromeTracingExporter.js +5 -6
- 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.9.0/detox-19.9.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar +0 -0
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.9.0/detox-19.9.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 -95
- 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,38 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @see https://www.npmjs.com/package/jest-circus#overview
|
7
|
-
*/
|
8
|
-
class JestCircusEnvironment extends NodeEnvironment {
|
9
|
-
constructor(config) {
|
10
|
-
super(config);
|
11
|
-
this.testEventListeners = [];
|
12
|
-
|
13
|
-
// Enable access to this instance (single in each worker's scope) by exposing a get-function.
|
14
|
-
// Note: whatever's set into this.global will be exported in that way. The reason behind it is that
|
15
|
-
// each suite is run inside a sandboxed JS context which scope is in fact this specific instance. See
|
16
|
-
// NodeEnvironment's constructor for more info, or https://jestjs.io/docs/en/configuration#testenvironment-string
|
17
|
-
// for additional ref.
|
18
|
-
this.global.detoxCircus = {
|
19
|
-
getEnv: () => this,
|
20
|
-
};
|
21
|
-
}
|
22
|
-
|
23
|
-
addEventsListener(listener) {
|
24
|
-
this.testEventListeners.push(listener);
|
25
|
-
}
|
26
|
-
|
27
|
-
async handleTestEvent(event, state) {
|
28
|
-
const name = event.name;
|
29
|
-
|
30
|
-
for (const listener of this.testEventListeners) {
|
31
|
-
if (typeof listener[name] === 'function') {
|
32
|
-
await listener[name](event, state);
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
module.exports = JestCircusEnvironment;
|
1
|
+
/** @deprecated */
|
2
|
+
/** @type {never} */
|
3
|
+
module.exports = require('../deprecation');
|
@@ -1,12 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
// These are not publicly used, but are defined in order to overlap with the jasmine.CustomReporter interface (which is a weak interface)
|
6
|
-
specDone: () => void;
|
7
|
-
specStarted: () => void;
|
8
|
-
}
|
9
|
-
|
10
|
-
declare const adapter: DetoxJestAdapter;
|
1
|
+
/***
|
2
|
+
* @deprecated Detox does not support old Jest integrations since v20.0.0
|
3
|
+
*/
|
4
|
+
declare const adapter: never;
|
11
5
|
|
12
6
|
export = adapter;
|
package/runners/jest/adapter.js
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
const DetoxAdapter = runnerInfo.isJestCircus ? require('./DetoxAdapterCircus') : require('./DetoxAdapterJasmine');
|
5
|
-
|
6
|
-
module.exports = new DetoxAdapter(detox);
|
1
|
+
/** @deprecated */
|
2
|
+
/** @type {never} */
|
3
|
+
module.exports = require('../deprecation');
|
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const Reporter = runnerInfo.isJestCircus ? require('./WorkerAssignReporterCircus') : require('./WorkerAssignReporterJasmine');
|
6
|
-
module.exports = new Reporter({ detox });
|
1
|
+
/** @deprecated */
|
2
|
+
/** @type {never} */
|
3
|
+
module.exports = require('../deprecation');
|
@@ -0,0 +1,25 @@
|
|
1
|
+
const chalk = require('chalk');
|
2
|
+
|
3
|
+
// @ts-ignore
|
4
|
+
console.error(chalk.yellow(`
|
5
|
+
========================= THE NEW JOURNEY BEGINS =============================
|
6
|
+
|
7
|
+
https://wix.github.io/Detox/docs/guide/jest
|
8
|
+
|
9
|
+
Sorry to say that Detox 20 comes without old adapters for Jest.
|
10
|
+
You have to rearrange your init code before you can continue your journey.
|
11
|
+
|
12
|
+
Navigate to the link and follow the migration guide steps.
|
13
|
+
|
14
|
+
Sincerely yours,
|
15
|
+
Detox team.
|
16
|
+
|
17
|
+
https://wix.github.io/Detox/docs/guide/jest
|
18
|
+
|
19
|
+
========================= THE NEW JOURNEY BEGINS =============================
|
20
|
+
|
21
|
+
`));
|
22
|
+
|
23
|
+
throw Object.assign(new Error(
|
24
|
+
'\n\nPlease follow the new Jest setup guide:\nhttps://wix.github.io/Detox/docs/guide/jest\n\n'
|
25
|
+
), { stack: '' });
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = async () => require('../../internals').globalSetup();
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = async () => require('../../internals').globalTeardown();
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module.exports = {
|
2
|
+
//#region *** Runner Realm ***
|
3
|
+
|
4
|
+
get DetoxCircusEnvironment() {
|
5
|
+
return require('./testEnvironment');
|
6
|
+
},
|
7
|
+
|
8
|
+
//#endregion
|
9
|
+
|
10
|
+
//#region *** Worker Realm ***
|
11
|
+
|
12
|
+
get globalSetup() {
|
13
|
+
return require('./globalSetup');
|
14
|
+
},
|
15
|
+
|
16
|
+
get globalTeardown() {
|
17
|
+
return require('./globalTeardown');
|
18
|
+
},
|
19
|
+
|
20
|
+
//#endregion
|
21
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./reporters/DetoxReporter');
|
@@ -1,11 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
specDone: () => void;
|
6
|
-
specStarted: () => void;
|
7
|
-
}
|
8
|
-
|
9
|
-
declare const specReporter: SpecReporter;
|
1
|
+
/***
|
2
|
+
* @deprecated Detox does not support old Jest integrations since v20.0.0
|
3
|
+
*/
|
4
|
+
declare const specReporter: never;
|
10
5
|
|
11
6
|
export = specReporter;
|
@@ -1,10 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
if (argparse.getArgValue('reportSpecs') === 'true') {
|
6
|
-
const Reporter = runnerInfo.isJestCircus ? require('./SpecReporterCircus') : require('./SpecReporterJasmine');
|
7
|
-
module.exports = new Reporter();
|
8
|
-
} else {
|
9
|
-
module.exports = {};
|
10
|
-
}
|
1
|
+
/** @deprecated */
|
2
|
+
/** @type {never} */
|
3
|
+
module.exports = require('../deprecation');
|
@@ -1,22 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
* TODO: rename this file to reporter.js in the next major version (Detox 18)
|
5
|
-
*/
|
6
|
-
|
7
|
-
const DetoxStreamlineJestReporter = require('./DetoxStreamlineJestReporter');
|
8
|
-
const FailingTestsReporter = require('./FailingTestsReporter');
|
9
|
-
|
10
|
-
class DetoxReporter extends DetoxStreamlineJestReporter {
|
11
|
-
constructor(globalConfig) {
|
12
|
-
super(globalConfig);
|
13
|
-
this._failingTestsReporter = new FailingTestsReporter();
|
14
|
-
}
|
15
|
-
|
16
|
-
async onRunComplete(contexts, results) {
|
17
|
-
await super.onRunComplete(contexts, results);
|
18
|
-
await this._failingTestsReporter.onRunComplete(contexts, results);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
module.exports = DetoxReporter;
|
1
|
+
/** @deprecated */
|
2
|
+
/** @type {never} */
|
3
|
+
module.exports = require('../deprecation');
|
@@ -0,0 +1,155 @@
|
|
1
|
+
// @ts-nocheck
|
2
|
+
const maybeNodeEnvironment = require('jest-environment-node'); // eslint-disable-line node/no-extraneous-require
|
3
|
+
const NodeEnvironment = maybeNodeEnvironment.default || maybeNodeEnvironment;
|
4
|
+
|
5
|
+
const detox = require('../../../internals');
|
6
|
+
const { DetoxError } = require('../../../src/errors');
|
7
|
+
const Timer = require('../../../src/utils/Timer');
|
8
|
+
|
9
|
+
const {
|
10
|
+
DetoxCoreListener,
|
11
|
+
DetoxInitErrorListener,
|
12
|
+
DetoxPlatformFilterListener,
|
13
|
+
SpecReporter,
|
14
|
+
WorkerAssignReporter
|
15
|
+
} = require('./listeners');
|
16
|
+
const assertExistingContext = require('./utils/assertExistingContext');
|
17
|
+
const { assertJestCircus27 } = require('./utils/assertJestCircus27');
|
18
|
+
|
19
|
+
const SYNC_CIRCUS_EVENTS = new Set([
|
20
|
+
'start_describe_definition',
|
21
|
+
'finish_describe_definition',
|
22
|
+
'add_hook',
|
23
|
+
'add_test',
|
24
|
+
'error',
|
25
|
+
]);
|
26
|
+
|
27
|
+
/**
|
28
|
+
* @see https://www.npmjs.com/package/jest-circus#overview
|
29
|
+
*/
|
30
|
+
class DetoxCircusEnvironment extends NodeEnvironment {
|
31
|
+
constructor(config, context) {
|
32
|
+
super(assertJestCircus27(config), assertExistingContext(context));
|
33
|
+
|
34
|
+
/** @private */
|
35
|
+
this._timer = null;
|
36
|
+
/** @private */
|
37
|
+
this._listenerFactories = {
|
38
|
+
DetoxInitErrorListener,
|
39
|
+
DetoxPlatformFilterListener,
|
40
|
+
DetoxCoreListener,
|
41
|
+
SpecReporter,
|
42
|
+
WorkerAssignReporter,
|
43
|
+
};
|
44
|
+
/** @protected */
|
45
|
+
this.testPath = context.testPath;
|
46
|
+
/** @protected */
|
47
|
+
this.testEventListeners = [];
|
48
|
+
/** @protected */
|
49
|
+
this.initTimeout = detox.config.runnerConfig.jest.initTimeout;
|
50
|
+
}
|
51
|
+
|
52
|
+
/** @override */
|
53
|
+
async setup() {
|
54
|
+
await super.setup();
|
55
|
+
|
56
|
+
await Timer.run({
|
57
|
+
description: `setting up Detox environment`,
|
58
|
+
timeout: this.initTimeout,
|
59
|
+
fn: async () => {
|
60
|
+
await this.initDetox();
|
61
|
+
this._instantiateListeners();
|
62
|
+
},
|
63
|
+
});
|
64
|
+
}
|
65
|
+
|
66
|
+
/** @override */
|
67
|
+
async handleTestEvent(event, state) {
|
68
|
+
const { name } = event;
|
69
|
+
|
70
|
+
if (SYNC_CIRCUS_EVENTS.has(name)) {
|
71
|
+
return this._handleTestEventSync(event, state);
|
72
|
+
}
|
73
|
+
|
74
|
+
this._timer = new Timer({
|
75
|
+
description: `handling jest-circus "${name}" event`,
|
76
|
+
timeout: state.testTimeout != null ? state.testTimeout : this.initTimeout,
|
77
|
+
});
|
78
|
+
|
79
|
+
try {
|
80
|
+
for (const listener of this.testEventListeners) {
|
81
|
+
if (typeof listener[name] !== 'function') {
|
82
|
+
continue;
|
83
|
+
}
|
84
|
+
|
85
|
+
try {
|
86
|
+
await this._timer.run(() => listener[name](event, state));
|
87
|
+
} catch (listenerError) {
|
88
|
+
this._logError(listenerError);
|
89
|
+
break;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
} finally {
|
93
|
+
this._timer.dispose();
|
94
|
+
this._timer = null;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
/** @override */
|
99
|
+
async teardown() {
|
100
|
+
await Timer.run({
|
101
|
+
description: `tearing down Detox environment`,
|
102
|
+
timeout: this.initTimeout,
|
103
|
+
fn: async () => {
|
104
|
+
await this.cleanupDetox();
|
105
|
+
},
|
106
|
+
});
|
107
|
+
}
|
108
|
+
|
109
|
+
/** @protected */
|
110
|
+
registerListeners(map) {
|
111
|
+
Object.assign(this._listenerFactories, map);
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* @protected
|
116
|
+
*/
|
117
|
+
async initDetox() {
|
118
|
+
await detox.setup({
|
119
|
+
global: this.global,
|
120
|
+
workerId: +process.env.JEST_WORKER_ID,
|
121
|
+
});
|
122
|
+
}
|
123
|
+
|
124
|
+
/** @protected */
|
125
|
+
async cleanupDetox() {
|
126
|
+
await detox.teardown();
|
127
|
+
}
|
128
|
+
|
129
|
+
/** @private */
|
130
|
+
_handleTestEventSync(event, state) {
|
131
|
+
const { name } = event;
|
132
|
+
|
133
|
+
for (const listener of this.testEventListeners) {
|
134
|
+
if (typeof listener[name] === 'function') {
|
135
|
+
listener[name](event, state);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
/** @private */
|
141
|
+
_instantiateListeners() {
|
142
|
+
for (const Listener of Object.values(this._listenerFactories)) {
|
143
|
+
this.testEventListeners.push(new Listener({
|
144
|
+
env: this,
|
145
|
+
}));
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
/** @private */
|
150
|
+
_logError(e) {
|
151
|
+
detox.log.error(DetoxError.format(e));
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
module.exports = DetoxCircusEnvironment;
|
@@ -1,25 +1,18 @@
|
|
1
1
|
// @ts-nocheck
|
2
2
|
const _ = require('lodash');
|
3
3
|
|
4
|
-
const
|
5
|
-
|
6
|
-
|
7
|
-
onHookFailure,
|
8
|
-
onTestFnFailure,
|
9
|
-
onTestDone,
|
10
|
-
onRunDescribeFinish,
|
11
|
-
} = require('../../integration').lifecycle;
|
12
|
-
const { getFullTestName, hasTimedOut } = require('../../jest/utils');
|
4
|
+
const detox = require('../../../..');
|
5
|
+
const detoxInternals = require('../../../../internals');
|
6
|
+
const { getFullTestName, hasTimedOut } = require('../utils');
|
13
7
|
|
14
8
|
const RETRY_TIMES = Symbol.for('RETRY_TIMES');
|
15
9
|
|
16
10
|
class DetoxCoreListener {
|
17
|
-
constructor({
|
11
|
+
constructor({ env }) {
|
18
12
|
this._startedTests = new WeakSet();
|
19
13
|
this._testsFailedBeforeStart = new WeakSet();
|
20
14
|
this._env = env;
|
21
15
|
this._testRunTimes = 1;
|
22
|
-
this.detox = detox;
|
23
16
|
}
|
24
17
|
|
25
18
|
_getTestInvocations(test) {
|
@@ -32,15 +25,22 @@ class DetoxCoreListener {
|
|
32
25
|
}
|
33
26
|
}
|
34
27
|
|
28
|
+
async setup() {
|
29
|
+
// Workaround to override Jest's expect
|
30
|
+
if (detoxInternals.config.behaviorConfig.init.exposeGlobals) {
|
31
|
+
this._env.global.expect = detox.expect;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
35
|
async run_describe_start({ describeBlock: { name, children } }) {
|
36
36
|
if (children.length) {
|
37
|
-
await
|
37
|
+
await detoxInternals.onRunDescribeStart({ name });
|
38
38
|
}
|
39
39
|
}
|
40
40
|
|
41
41
|
async run_describe_finish({ describeBlock: { name, children } }) {
|
42
42
|
if (children.length) {
|
43
|
-
await
|
43
|
+
await detoxInternals.onRunDescribeFinish({ name });
|
44
44
|
}
|
45
45
|
}
|
46
46
|
|
@@ -58,7 +58,7 @@ class DetoxCoreListener {
|
|
58
58
|
}
|
59
59
|
|
60
60
|
async hook_failure({ error, hook }) {
|
61
|
-
await
|
61
|
+
await detoxInternals.onHookFailure({
|
62
62
|
error,
|
63
63
|
hook: hook.type,
|
64
64
|
});
|
@@ -69,7 +69,7 @@ class DetoxCoreListener {
|
|
69
69
|
}
|
70
70
|
|
71
71
|
async test_fn_failure({ error }) {
|
72
|
-
await
|
72
|
+
await detoxInternals.onTestFnFailure({ error });
|
73
73
|
}
|
74
74
|
|
75
75
|
async _onBeforeActualTestStart(test) {
|
@@ -79,7 +79,7 @@ class DetoxCoreListener {
|
|
79
79
|
|
80
80
|
this._startedTests.add(test);
|
81
81
|
|
82
|
-
await
|
82
|
+
await detoxInternals.onTestStart({
|
83
83
|
title: test.name,
|
84
84
|
fullName: getFullTestName(test),
|
85
85
|
status: 'running',
|
@@ -89,7 +89,7 @@ class DetoxCoreListener {
|
|
89
89
|
|
90
90
|
async test_done({ test }) {
|
91
91
|
if (this._startedTests.has(test)) {
|
92
|
-
await
|
92
|
+
await detoxInternals.onTestDone({
|
93
93
|
title: test.name,
|
94
94
|
fullName: getFullTestName(test),
|
95
95
|
status: test.errors.length ? 'failed' : 'passed',
|
@@ -100,6 +100,24 @@ class DetoxCoreListener {
|
|
100
100
|
this._startedTests.delete(test);
|
101
101
|
}
|
102
102
|
}
|
103
|
+
|
104
|
+
async run_finish(_event, state) {
|
105
|
+
if (this._hasFailedTests(state.rootDescribeBlock)) {
|
106
|
+
await detoxInternals.reportFailedTests([this._env.testPath]);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
_hasFailedTests(block) {
|
111
|
+
if (block.children) {
|
112
|
+
for (const child of block.children) {
|
113
|
+
if (this._hasFailedTests(child)) {
|
114
|
+
return true;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
return block.errors ? block.errors.length > 0 : false;
|
120
|
+
}
|
103
121
|
}
|
104
122
|
|
105
123
|
module.exports = DetoxCoreListener;
|
@@ -15,7 +15,7 @@ class DetoxInitErrorListener {
|
|
15
15
|
if (!_.isEmpty(unhandledErrors)) {
|
16
16
|
const currentTest = _.last(currentDescribeBlock.children);
|
17
17
|
const dummyError = new Error('Environment setup failed. See the detailed error below.');
|
18
|
-
|
18
|
+
dummyError.stack = '';
|
19
19
|
|
20
20
|
currentTest.errors.push(dummyError);
|
21
21
|
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
const _ = require('lodash');
|
2
|
+
|
3
|
+
const { device } = require('../../../..');
|
4
|
+
|
5
|
+
const PLATFORM_REGEXP = /^:([^:]+):/;
|
6
|
+
|
7
|
+
class DetoxPlatformFilterListener {
|
8
|
+
constructor() {
|
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,7 @@
|
|
1
1
|
const chalk = require('chalk').default;
|
2
2
|
|
3
|
-
const log = require('
|
4
|
-
|
5
|
-
const { traceln } = require('./utils/stdout');
|
3
|
+
const { config, log, session } = require('../../../../internals');
|
4
|
+
const { traceln } = require('../utils/stdout');
|
6
5
|
|
7
6
|
const RESULT_SKIPPED = chalk.yellow('SKIPPED');
|
8
7
|
const RESULT_FAILED = chalk.red('FAIL');
|
@@ -16,12 +15,67 @@ class SpecReporter {
|
|
16
15
|
this._suitesDesc = '';
|
17
16
|
}
|
18
17
|
|
19
|
-
|
18
|
+
get enabled() {
|
19
|
+
const jestSection = config.runnerConfig.jest;
|
20
|
+
const reportSpecs = jestSection && jestSection.reportSpecs;
|
21
|
+
|
22
|
+
return reportSpecs !== undefined ? reportSpecs : session.workersCount === 1;
|
23
|
+
}
|
24
|
+
|
25
|
+
run_describe_start(event) {
|
26
|
+
if (!this.enabled) return;
|
27
|
+
|
28
|
+
if (event.describeBlock.parent !== undefined) {
|
29
|
+
this._onSuiteStart({
|
30
|
+
description: event.describeBlock.name,
|
31
|
+
});
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
run_describe_finish(event) {
|
36
|
+
if (!this.enabled) return;
|
37
|
+
|
38
|
+
if (event.describeBlock.parent !== undefined) {
|
39
|
+
this._onSuiteEnd();
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
test_start(event) {
|
44
|
+
if (!this.enabled) return;
|
45
|
+
|
46
|
+
const { test } = event;
|
47
|
+
this._onTestStart({
|
48
|
+
description: test.name,
|
49
|
+
invocations: test.invocations,
|
50
|
+
});
|
51
|
+
}
|
52
|
+
|
53
|
+
test_done(event) {
|
54
|
+
if (!this.enabled) return;
|
55
|
+
|
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
|
+
if (!this.enabled) return;
|
66
|
+
|
67
|
+
const testInfo = {
|
68
|
+
description: event.test.name,
|
69
|
+
};
|
70
|
+
this._onTestEnd(testInfo, 'skipped');
|
71
|
+
}
|
72
|
+
|
73
|
+
_onSuiteStart({ description }) {
|
20
74
|
this._suites.push({ description });
|
21
75
|
this._regenerateSuitesDesc();
|
22
76
|
}
|
23
77
|
|
24
|
-
|
78
|
+
_onSuiteEnd() {
|
25
79
|
this._suites.pop();
|
26
80
|
this._regenerateSuitesDesc();
|
27
81
|
|
@@ -30,11 +84,11 @@ class SpecReporter {
|
|
30
84
|
}
|
31
85
|
}
|
32
86
|
|
33
|
-
|
87
|
+
_onTestStart({ description, invocations = 1 }) {
|
34
88
|
this._traceTest({ description, invocations });
|
35
89
|
}
|
36
90
|
|
37
|
-
|
91
|
+
_onTestEnd({ description, invocations = 1 }, result) {
|
38
92
|
let status;
|
39
93
|
switch (result) {
|
40
94
|
case 'skipped': status = RESULT_SKIPPED; break;
|
@@ -0,0 +1,34 @@
|
|
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.runnerConfig.jest.reportWorkerAssign) {
|
16
|
+
log.info({ event: 'WORKER_ASSIGN' }, `${this._formatTestName()} 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
|
+
_formatTestName() {
|
30
|
+
return chalk.whiteBright(this._testName);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
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;
|