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,60 +0,0 @@
|
|
1
|
-
const DetoxAdapter = require('./DetoxAdapterImpl');
|
2
|
-
const { getFullTestName, hasTimedOut } = require('./utils');
|
3
|
-
|
4
|
-
class DetoxAdapterCircus {
|
5
|
-
constructor(detox) {
|
6
|
-
this._adapter = new DetoxAdapter(detox, DetoxAdapterCircus._describeInitError);
|
7
|
-
}
|
8
|
-
|
9
|
-
static _describeInitError() {
|
10
|
-
return {
|
11
|
-
message: 'Detox adapter to Jest is malfunctioning.',
|
12
|
-
hint: `Make sure you register it as a test-event listener inside init.js:\n` +
|
13
|
-
`-------------------------------------------------------------\n` +
|
14
|
-
'detoxCircus.getEnv().addEventsListener(adapter);',
|
15
|
-
};
|
16
|
-
}
|
17
|
-
|
18
|
-
async beforeEach() {
|
19
|
-
await this._adapter.beforeEach();
|
20
|
-
}
|
21
|
-
|
22
|
-
async afterAll() {
|
23
|
-
await this._adapter.afterAll();
|
24
|
-
}
|
25
|
-
|
26
|
-
async run_describe_start({ describeBlock: { name, children } }, state) { // eslint-disable-line no-unused-vars
|
27
|
-
if (children.length) await this._adapter.suiteStart({ name });
|
28
|
-
}
|
29
|
-
|
30
|
-
async run_describe_finish({ describeBlock: { name, children } }, state) { // eslint-disable-line no-unused-vars
|
31
|
-
if (children.length) await this._adapter.suiteEnd({ name });
|
32
|
-
}
|
33
|
-
|
34
|
-
test_start(event) {
|
35
|
-
const { test } = event;
|
36
|
-
if (test.mode === 'skip' || test.mode === 'todo' || test.errors.length > 0) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
|
40
|
-
this._adapter.testStart({
|
41
|
-
title: test.name,
|
42
|
-
fullName: getFullTestName(test),
|
43
|
-
status: 'running',
|
44
|
-
});
|
45
|
-
}
|
46
|
-
|
47
|
-
test_done(event) {
|
48
|
-
const { test } = event;
|
49
|
-
this._adapter.testComplete({
|
50
|
-
status: test.errors.length ? 'failed' : 'passed',
|
51
|
-
timedOut: hasTimedOut(test)
|
52
|
-
});
|
53
|
-
}
|
54
|
-
|
55
|
-
test_skip(event) { // eslint-disable-line no-unused-vars
|
56
|
-
// Ignored (for clarity)
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
module.exports = DetoxAdapterCircus;
|
@@ -1,81 +0,0 @@
|
|
1
|
-
const DetoxRuntimeError = require('../../src/errors/DetoxRuntimeError');
|
2
|
-
const log = require('../../src/utils/logger').child({ __filename });
|
3
|
-
|
4
|
-
class DetoxAdapterImpl {
|
5
|
-
constructor(detox, describeInitErrorFn) {
|
6
|
-
if (process.env.DETOX_RERUN_INDEX) {
|
7
|
-
log.warn(
|
8
|
-
'While Detox CLI supports "-R <N>, --retries <N>" mechanism, ' +
|
9
|
-
'this outdated Jest integration does not — expect artifacts issues. ' +
|
10
|
-
'Please migrate to the new Jest Circus integration.\n\n' +
|
11
|
-
'See: https://wix.github.io/Detox/docs/api/guide/jest\n');
|
12
|
-
}
|
13
|
-
|
14
|
-
this.detox = detox;
|
15
|
-
this._describeInitError = describeInitErrorFn;
|
16
|
-
this._currentTest = null;
|
17
|
-
this._todos = [];
|
18
|
-
}
|
19
|
-
|
20
|
-
async beforeEach() {
|
21
|
-
if (!this._currentTest) {
|
22
|
-
throw new DetoxRuntimeError(this._describeInitError());
|
23
|
-
}
|
24
|
-
|
25
|
-
const currentTest = this._currentTest;
|
26
|
-
|
27
|
-
await this._flush();
|
28
|
-
await this.detox.beforeEach(currentTest);
|
29
|
-
}
|
30
|
-
|
31
|
-
async afterAll() {
|
32
|
-
await this._flush();
|
33
|
-
}
|
34
|
-
|
35
|
-
async suiteStart({ name }) {
|
36
|
-
this._enqueue(() => this.detox.suiteStart({ name }));
|
37
|
-
}
|
38
|
-
|
39
|
-
async suiteEnd({ name }) {
|
40
|
-
this._enqueue(() => this.detox.suiteEnd({ name }));
|
41
|
-
}
|
42
|
-
|
43
|
-
testStart({ title, fullName, status }) {
|
44
|
-
this._currentTest = {
|
45
|
-
title,
|
46
|
-
fullName,
|
47
|
-
status,
|
48
|
-
};
|
49
|
-
}
|
50
|
-
|
51
|
-
testComplete({ status, timedOut }) {
|
52
|
-
if (this._currentTest) {
|
53
|
-
const _test = {
|
54
|
-
...this._currentTest,
|
55
|
-
status,
|
56
|
-
timedOut,
|
57
|
-
};
|
58
|
-
|
59
|
-
this._currentTest = null;
|
60
|
-
this._enqueue(() => this._afterEach(_test));
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
async _afterEach(previousTest) {
|
65
|
-
await this.detox.afterEach(previousTest);
|
66
|
-
}
|
67
|
-
|
68
|
-
_enqueue(fn) {
|
69
|
-
this._todos.push(fn);
|
70
|
-
}
|
71
|
-
|
72
|
-
async _flush() {
|
73
|
-
const t = this._todos;
|
74
|
-
|
75
|
-
while (t.length > 0) {
|
76
|
-
await Promise.resolve().then(t.shift()).catch(()=>{});
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
module.exports = DetoxAdapterImpl;
|
@@ -1,67 +0,0 @@
|
|
1
|
-
const _ = require('lodash');
|
2
|
-
|
3
|
-
const DetoxAdapter = require('./DetoxAdapterImpl');
|
4
|
-
|
5
|
-
class DetoxAdapterJasmine /* extends JasmineReporter */ {
|
6
|
-
constructor(detox) {
|
7
|
-
this._adapter = new DetoxAdapter(detox, DetoxAdapterJasmine._describeInitError);
|
8
|
-
}
|
9
|
-
|
10
|
-
static _describeInitError() {
|
11
|
-
return {
|
12
|
-
message: 'Detox adapter to Jest is malfunctioning.',
|
13
|
-
hint: `Make sure you register it as Jasmine reporter inside init.js:\n` +
|
14
|
-
`-------------------------------------------------------------\n` +
|
15
|
-
'jasmine.getEnv().addReporter(adapter);',
|
16
|
-
};
|
17
|
-
}
|
18
|
-
|
19
|
-
async beforeEach() {
|
20
|
-
await this._adapter.beforeEach();
|
21
|
-
}
|
22
|
-
|
23
|
-
async afterAll() {
|
24
|
-
await this._adapter.afterAll();
|
25
|
-
}
|
26
|
-
|
27
|
-
async suiteStarted(result) {
|
28
|
-
await this._adapter.suiteStart({ name: result.description });
|
29
|
-
}
|
30
|
-
|
31
|
-
async suiteDone(result) {
|
32
|
-
await this._adapter.suiteEnd({ name: result.description });
|
33
|
-
}
|
34
|
-
|
35
|
-
specStarted(result) {
|
36
|
-
if (result.pendingReason) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
|
40
|
-
this._adapter.testStart({
|
41
|
-
title: result.description,
|
42
|
-
fullName: result.fullName,
|
43
|
-
status: 'running',
|
44
|
-
});
|
45
|
-
}
|
46
|
-
|
47
|
-
specDone(result) {
|
48
|
-
if (result.status === 'disabled' || result.pendingReason) {
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
|
52
|
-
this._adapter.testComplete({
|
53
|
-
status: result.status,
|
54
|
-
timedOut: this._hasTimedOut(result),
|
55
|
-
});
|
56
|
-
}
|
57
|
-
|
58
|
-
_hasTimedOut(result) {
|
59
|
-
return _.chain(result.failedExpectations)
|
60
|
-
.map('error')
|
61
|
-
.compact()
|
62
|
-
.some(e => _.includes(e.message, 'Timeout'))
|
63
|
-
.value();
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
module.exports = DetoxAdapterJasmine;
|
@@ -1,98 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const { VerboseReporter: JestVerboseReporter } = require('@jest/reporters'); // eslint-disable-line node/no-extraneous-require
|
3
|
-
|
4
|
-
const DetoxRuntimeError = require('../../src/errors/DetoxRuntimeError');
|
5
|
-
|
6
|
-
class DetoxStreamlineJestReporter extends JestVerboseReporter {
|
7
|
-
|
8
|
-
constructor(globalConfig) {
|
9
|
-
super(globalConfig);
|
10
|
-
this._assertConfig();
|
11
|
-
}
|
12
|
-
|
13
|
-
/**
|
14
|
-
* Monkey patch for _wrapStdio method of Jest's DefaultReporter class
|
15
|
-
* https://github.com/facebook/jest/blob/84466b7bb187d33ffd336bd9fc76111bba511fe6/packages/jest-reporters/src/default_reporter.ts#L47
|
16
|
-
*
|
17
|
-
* The official implementation does the following:
|
18
|
-
* - For the <b>stderr</b> stream, it overrides the 'write' method with a simple bulked output mechanism,
|
19
|
-
* which aggregates output onto a buffer but flushes it immediately.
|
20
|
-
* - For the <b>stdout</b> stream, it overrides the 'write' method with a time-based bulked output mechanism,
|
21
|
-
* which aggregates output onto a buffer and flushes only in 100ms intervals.
|
22
|
-
*
|
23
|
-
* This gives priority, to a certain extent, to stderr output, over stdout.
|
24
|
-
* See: https://github.com/facebook/jest/blob/84466b7bb187d33ffd336bd9fc76111bba511fe6/packages/jest-reporters/src/default_reporter.ts#L73
|
25
|
-
*
|
26
|
-
* Typically, user logs are sent to stdout, and Jest reporter's (e.g. test-suite summary) - to stderr.
|
27
|
-
*
|
28
|
-
* ---
|
29
|
-
* Our goal is to have these 3 types of output streamlined in real time:
|
30
|
-
*
|
31
|
-
* 1. Jest suite-level lifecycle logging, typically done by the super-class' impl.
|
32
|
-
* Note: Jest does not notify spec-level events to reporters.
|
33
|
-
* 2. Jasmine real-time, spec-level lifecycle logging.
|
34
|
-
* 3. User in-test logging (e.g. for debugging).
|
35
|
-
*
|
36
|
-
* It's easy to see that this cannot be done while stderr and stdout are not of equal priority.
|
37
|
-
* Therefore, this hack enforces immediate-flushing approach to <b>both</b> stderr and stdout.
|
38
|
-
*/
|
39
|
-
_wrapStdio(stream) {
|
40
|
-
const originalWrite = stream.write;
|
41
|
-
let buffer = [];
|
42
|
-
|
43
|
-
const flushBufferedOutput = () => {
|
44
|
-
const string = buffer.join('');
|
45
|
-
buffer = []; // This is to avoid conflicts between random output and status text
|
46
|
-
|
47
|
-
this._clearStatus();
|
48
|
-
|
49
|
-
if (string) {
|
50
|
-
originalWrite.call(stream, string);
|
51
|
-
}
|
52
|
-
|
53
|
-
this._printStatus();
|
54
|
-
|
55
|
-
this._bufferedOutput.delete(flushBufferedOutput);
|
56
|
-
};
|
57
|
-
|
58
|
-
this._bufferedOutput.add(flushBufferedOutput);
|
59
|
-
|
60
|
-
stream.write = chunk => {
|
61
|
-
buffer.push(chunk);
|
62
|
-
flushBufferedOutput();
|
63
|
-
return true;
|
64
|
-
};
|
65
|
-
}
|
66
|
-
|
67
|
-
_assertConfig() {
|
68
|
-
if (!this._isVerboseEnabled()) {
|
69
|
-
// Non-verbose mode makes Jest swizzle 'console' with a buffered output impl, which prevents
|
70
|
-
// user and detox' jasmine-lifecycle logs from showing in real time.
|
71
|
-
throw new DetoxRuntimeError({
|
72
|
-
message: 'Cannot run properly unless Jest is in verbose mode',
|
73
|
-
hint: 'See https://jestjs.io/docs/en/configuration#verbose-boolean for more details',
|
74
|
-
});
|
75
|
-
}
|
76
|
-
|
77
|
-
if (this._hasDefaultReporter()) {
|
78
|
-
// This class overrides Jest's VerboseReporter, which is set by default. Can't have both.
|
79
|
-
throw new DetoxRuntimeError({
|
80
|
-
message: 'Cannot work alongside the default Jest reporter. Please remove it from the reporters list.',
|
81
|
-
hint: 'See https://jestjs.io/docs/en/configuration#reporters-array-modulename-modulename-options for more details',
|
82
|
-
});
|
83
|
-
}
|
84
|
-
}
|
85
|
-
|
86
|
-
_isVerboseEnabled() {
|
87
|
-
return !!this._globalConfig.verbose;
|
88
|
-
}
|
89
|
-
|
90
|
-
_hasDefaultReporter() {
|
91
|
-
return !!this._globalConfig.reporters.find(reporterDef => {
|
92
|
-
const [reporterName] = reporterDef;
|
93
|
-
return reporterName === 'default';
|
94
|
-
});
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
module.exports = DetoxStreamlineJestReporter;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
const path = require('path');
|
2
|
-
|
3
|
-
const { saveLastFailedTests } = require('../../src/utils/lastFailedTests');
|
4
|
-
|
5
|
-
class FailingTestsReporter {
|
6
|
-
async onRunComplete(_contexts, { testResults }) {
|
7
|
-
const cwd = process.cwd();
|
8
|
-
const failedFiles = testResults
|
9
|
-
.filter(result => result.numFailingTests > 0)
|
10
|
-
.map(result => path.relative(cwd, result.testFilePath));
|
11
|
-
|
12
|
-
await saveLastFailedTests(failedFiles);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
module.exports = FailingTestsReporter;
|
@@ -1,51 +0,0 @@
|
|
1
|
-
const argparse = require('../../src/utils/argparse');
|
2
|
-
|
3
|
-
const SpecReporter = require('./SpecReporterImpl');
|
4
|
-
|
5
|
-
class SpecReporterCircus {
|
6
|
-
constructor() {
|
7
|
-
this._specReporter = new SpecReporter();
|
8
|
-
}
|
9
|
-
|
10
|
-
run_describe_start(event) {
|
11
|
-
if (event.describeBlock.parent !== undefined) {
|
12
|
-
this._specReporter.onSuiteStart({
|
13
|
-
description: event.describeBlock.name,
|
14
|
-
});
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
run_describe_finish(event) {
|
19
|
-
if (event.describeBlock.parent !== undefined) {
|
20
|
-
this._specReporter.onSuiteEnd();
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
test_start(event) {
|
25
|
-
const { test } = event;
|
26
|
-
this._specReporter.onTestStart({
|
27
|
-
description: test.name,
|
28
|
-
invocations: test.invocations,
|
29
|
-
});
|
30
|
-
}
|
31
|
-
|
32
|
-
test_done(event) {
|
33
|
-
const { test } = event;
|
34
|
-
const testInfo = {
|
35
|
-
description: test.name,
|
36
|
-
invocations: test.invocations,
|
37
|
-
};
|
38
|
-
this._specReporter.onTestEnd(testInfo, test.errors.length ? 'failed' : 'success');
|
39
|
-
}
|
40
|
-
|
41
|
-
test_skip(event) {
|
42
|
-
const testInfo = {
|
43
|
-
description: event.test.name,
|
44
|
-
};
|
45
|
-
this._specReporter.onTestEnd(testInfo, 'skipped');
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
module.exports = argparse.getArgValue('reportSpecs') === 'true'
|
50
|
-
? SpecReporterCircus
|
51
|
-
: class {};
|
@@ -1,39 +0,0 @@
|
|
1
|
-
const SpecReporter = require('./SpecReporterImpl');
|
2
|
-
|
3
|
-
/***
|
4
|
-
* @see {@link https://jasmine.github.io/api/2.9/Reporter.html}
|
5
|
-
*/
|
6
|
-
class SpecReporterJasmine {
|
7
|
-
constructor() {
|
8
|
-
this._specReporter = new SpecReporter();
|
9
|
-
}
|
10
|
-
|
11
|
-
suiteStarted(suiteInfo) {
|
12
|
-
this._specReporter.onSuiteStart(suiteInfo);
|
13
|
-
}
|
14
|
-
|
15
|
-
suiteDone() {
|
16
|
-
this._specReporter.onSuiteEnd();
|
17
|
-
}
|
18
|
-
|
19
|
-
specStarted(specInfo) {
|
20
|
-
this._specReporter.onTestStart(specInfo);
|
21
|
-
}
|
22
|
-
|
23
|
-
specDone(specResult) {
|
24
|
-
let result;
|
25
|
-
if (specResult.status === 'disabled') {
|
26
|
-
result = 'skipped';
|
27
|
-
} else if (specResult.status === 'failed') {
|
28
|
-
result = 'failed';
|
29
|
-
} else if (specResult.pendingReason) {
|
30
|
-
result = 'pending';
|
31
|
-
} else {
|
32
|
-
result = 'success';
|
33
|
-
}
|
34
|
-
|
35
|
-
this._specReporter.onTestEnd(specResult, result);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
module.exports = SpecReporterJasmine;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
const WorkerAssignReporter = require('./WorkerAssignReporterImpl');
|
2
|
-
|
3
|
-
class WorkerAssignReporterCircus {
|
4
|
-
constructor({ detox }) {
|
5
|
-
this._reporter = new WorkerAssignReporter(detox);
|
6
|
-
}
|
7
|
-
|
8
|
-
run_describe_start(event) {
|
9
|
-
const { describeBlock } = event;
|
10
|
-
|
11
|
-
if (describeBlock.parent && describeBlock.parent.parent === undefined) {
|
12
|
-
this._reporter.report(describeBlock.name);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
}
|
16
|
-
|
17
|
-
module.exports = WorkerAssignReporterCircus;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
const chalk = require('chalk').default;
|
2
|
-
const _ = require('lodash');
|
3
|
-
|
4
|
-
const log = require('../../src/utils/logger').child();
|
5
|
-
|
6
|
-
class WorkerAssignReporterImpl {
|
7
|
-
constructor(detox) {
|
8
|
-
this.device = detox && detox.device;
|
9
|
-
}
|
10
|
-
|
11
|
-
report(workerName) {
|
12
|
-
const deviceName = _.attempt(() => this.device.name);
|
13
|
-
const formattedDeviceName = _.isError(deviceName)
|
14
|
-
? chalk.redBright('undefined')
|
15
|
-
: chalk.blueBright(deviceName);
|
16
|
-
|
17
|
-
log.info({ event: 'WORKER_ASSIGN' }, `${chalk.whiteBright(workerName)} is assigned to ${formattedDeviceName}`);
|
18
|
-
}
|
19
|
-
}
|
20
|
-
|
21
|
-
module.exports = WorkerAssignReporterImpl;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
const path = require('path');
|
2
|
-
|
3
|
-
const WorkerAssignReporter = require('./WorkerAssignReporterImpl');
|
4
|
-
|
5
|
-
class WorkerAssignReporterJasmine {
|
6
|
-
constructor({ detox }) {
|
7
|
-
this._reporter = new WorkerAssignReporter(detox);
|
8
|
-
}
|
9
|
-
|
10
|
-
suiteStarted(suiteInfo) {
|
11
|
-
const workerName = path.basename(suiteInfo.testPath);
|
12
|
-
this._reporter.report(workerName);
|
13
|
-
}
|
14
|
-
}
|
15
|
-
module.exports = WorkerAssignReporterJasmine;
|
@@ -1,206 +0,0 @@
|
|
1
|
-
// @ts-nocheck
|
2
|
-
const maybeNodeEnvironment = require('jest-environment-node'); // eslint-disable-line node/no-unpublished-require
|
3
|
-
const NodeEnvironment = maybeNodeEnvironment.default || maybeNodeEnvironment;
|
4
|
-
|
5
|
-
const DetoxError = require('../../src/errors/DetoxError');
|
6
|
-
const Timer = require('../../src/utils/Timer');
|
7
|
-
|
8
|
-
const DetoxCoreListener = require('./listeners/DetoxCoreListener');
|
9
|
-
const DetoxInitErrorListener = require('./listeners/DetoxInitErrorListener');
|
10
|
-
const assertExistingContext = require('./utils/assertExistingContext');
|
11
|
-
const assertJestCircus26 = require('./utils/assertJestCircus26');
|
12
|
-
const wrapErrorWithNoopLifecycle = require('./utils/wrapErrorWithNoopLifecycle');
|
13
|
-
|
14
|
-
const SYNC_CIRCUS_EVENTS = new Set([
|
15
|
-
'start_describe_definition',
|
16
|
-
'finish_describe_definition',
|
17
|
-
'add_hook',
|
18
|
-
'add_test',
|
19
|
-
'error',
|
20
|
-
]);
|
21
|
-
|
22
|
-
/**
|
23
|
-
* @see https://www.npmjs.com/package/jest-circus#overview
|
24
|
-
*/
|
25
|
-
class DetoxCircusEnvironment extends NodeEnvironment {
|
26
|
-
constructor(config, context) {
|
27
|
-
super(assertJestCircus26(config), assertExistingContext(context));
|
28
|
-
|
29
|
-
/** @private */
|
30
|
-
this._timer = null;
|
31
|
-
/** @private */
|
32
|
-
this._listenerFactories = {
|
33
|
-
DetoxInitErrorListener,
|
34
|
-
DetoxCoreListener,
|
35
|
-
};
|
36
|
-
/** @private */
|
37
|
-
this._calledDetoxInit = false;
|
38
|
-
/** @private */
|
39
|
-
this._calledDetoxCleanup = false;
|
40
|
-
/** @protected */
|
41
|
-
this.testPath = context.testPath;
|
42
|
-
/** @protected */
|
43
|
-
this.testEventListeners = [];
|
44
|
-
/** @protected */
|
45
|
-
this.initTimeout = 300000;
|
46
|
-
}
|
47
|
-
|
48
|
-
async setup() {
|
49
|
-
await super.setup();
|
50
|
-
|
51
|
-
this.global.detox = require('../../src')
|
52
|
-
._setGlobal(this.global)
|
53
|
-
._suppressLoggingInitErrors();
|
54
|
-
}
|
55
|
-
|
56
|
-
async teardown() {
|
57
|
-
try {
|
58
|
-
if (this._calledDetoxInit && !this._calledDetoxCleanup) {
|
59
|
-
await this._runEmergencyTeardown();
|
60
|
-
}
|
61
|
-
} finally {
|
62
|
-
await super.teardown();
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
get detox() {
|
67
|
-
return this.global.detox;
|
68
|
-
}
|
69
|
-
|
70
|
-
async handleTestEvent(event, state) {
|
71
|
-
const { name } = event;
|
72
|
-
|
73
|
-
if (SYNC_CIRCUS_EVENTS.has(name)) {
|
74
|
-
return this._handleTestEventSync(event, state);
|
75
|
-
}
|
76
|
-
|
77
|
-
this._timer = new Timer({
|
78
|
-
description: `handling jest-circus "${name}" event`,
|
79
|
-
timeout: name === 'setup' ? this.initTimeout : state.testTimeout,
|
80
|
-
});
|
81
|
-
|
82
|
-
try {
|
83
|
-
if (name === 'setup') {
|
84
|
-
await this._onSetup(state);
|
85
|
-
}
|
86
|
-
|
87
|
-
for (const listener of this.testEventListeners) {
|
88
|
-
if (typeof listener[name] === 'function') {
|
89
|
-
try {
|
90
|
-
await this._timer.run(() => listener[name](event, state));
|
91
|
-
} catch (listenerError) {
|
92
|
-
this._logError(listenerError);
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
if (name === 'teardown') {
|
98
|
-
await this._onTeardown(state);
|
99
|
-
}
|
100
|
-
} finally {
|
101
|
-
this._timer.dispose();
|
102
|
-
this._timer = null;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
_handleTestEventSync(event, state) {
|
107
|
-
const { name } = event;
|
108
|
-
|
109
|
-
for (const listener of this.testEventListeners) {
|
110
|
-
if (typeof listener[name] === 'function') {
|
111
|
-
listener[name](event, state);
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
async _onSetup(state) {
|
117
|
-
let detox;
|
118
|
-
|
119
|
-
try {
|
120
|
-
detox = await this._timer.run(async () => {
|
121
|
-
try {
|
122
|
-
this._calledDetoxInit = true;
|
123
|
-
return await this.initDetox();
|
124
|
-
} catch (actualError) {
|
125
|
-
state.unhandledErrors.push(actualError);
|
126
|
-
this._logError(actualError);
|
127
|
-
throw actualError;
|
128
|
-
}
|
129
|
-
});
|
130
|
-
} catch (maybeActualError) {
|
131
|
-
if (!state.unhandledErrors.includes(maybeActualError)) {
|
132
|
-
const timeoutError = maybeActualError;
|
133
|
-
state.unhandledErrors.push(timeoutError);
|
134
|
-
this._logError(timeoutError);
|
135
|
-
}
|
136
|
-
|
137
|
-
detox = wrapErrorWithNoopLifecycle(maybeActualError);
|
138
|
-
} finally {
|
139
|
-
this._timer.reset(state.testTimeout);
|
140
|
-
}
|
141
|
-
|
142
|
-
this._instantiateListeners(detox);
|
143
|
-
}
|
144
|
-
|
145
|
-
_instantiateListeners(detoxInstance) {
|
146
|
-
for (const Listener of Object.values(this._listenerFactories)) {
|
147
|
-
this.testEventListeners.push(new Listener({
|
148
|
-
detox: detoxInstance,
|
149
|
-
env: this,
|
150
|
-
}));
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
async _onTeardown(state) {
|
155
|
-
try {
|
156
|
-
this._calledDetoxCleanup = true;
|
157
|
-
await this._timer.run(() => this.cleanupDetox());
|
158
|
-
} catch (cleanupError) {
|
159
|
-
state.unhandledErrors.push(cleanupError);
|
160
|
-
this._logError(cleanupError);
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
async _runEmergencyTeardown() {
|
165
|
-
this._timer = new Timer({
|
166
|
-
description: `handling environment teardown`,
|
167
|
-
timeout: this.initTimeout,
|
168
|
-
});
|
169
|
-
|
170
|
-
try {
|
171
|
-
await this._timer.run(() => this.cleanupDetox());
|
172
|
-
} catch (cleanupError) {
|
173
|
-
this._logError(cleanupError);
|
174
|
-
} finally {
|
175
|
-
this._timer.dispose();
|
176
|
-
this._timer = null;
|
177
|
-
}
|
178
|
-
}
|
179
|
-
|
180
|
-
/** @private */
|
181
|
-
get _logger() {
|
182
|
-
return require('../../src/utils/logger');
|
183
|
-
}
|
184
|
-
|
185
|
-
/** @private */
|
186
|
-
_logError(e) {
|
187
|
-
this._logger.error(DetoxError.format(e));
|
188
|
-
}
|
189
|
-
|
190
|
-
/** @protected */
|
191
|
-
async initDetox() {
|
192
|
-
return this.detox.init();
|
193
|
-
}
|
194
|
-
|
195
|
-
/** @protected */
|
196
|
-
async cleanupDetox() {
|
197
|
-
return this.detox.cleanup();
|
198
|
-
}
|
199
|
-
|
200
|
-
/** @protected */
|
201
|
-
registerListeners(map) {
|
202
|
-
Object.assign(this._listenerFactories, map);
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
module.exports = DetoxCircusEnvironment;
|