detox 20.0.3-breaking.new-global-lifecycle.0 → 20.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar → 20.0.3/detox-20.0.3-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar → 20.0.3/detox-20.0.3-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom → 20.0.3/detox-20.0.3.pom} +1 -7
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.3/detox-20.0.3.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/build.gradle +12 -7
- package/android/detox/build.gradle +13 -9
- package/android/detox/proguard-rules-app.pro +6 -0
- package/android/detox/proguard-rules.pro +3 -0
- package/android/detox/publishing.gradle +27 -27
- package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeExtension.kt +15 -2
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/IdlingResourceDescription.kt +19 -13
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +33 -30
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
- package/android/detox/src/main/java/com/wix/detox/common/TextFileReader.kt +1 -1
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/DetoxMultiTapSpec.kt +4 -3
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
- package/index.d.ts +195 -59
- package/internals.d.ts +205 -43
- package/local-cli/build.js +1 -1
- package/local-cli/cli.js +11 -6
- package/local-cli/init.js +61 -21
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/templates/jest.js +13 -10
- package/local-cli/test.js +14 -8
- package/local-cli/test.test.js +142 -61
- package/local-cli/testCommand/TestRunnerCommand.js +97 -77
- package/local-cli/testCommand/TestRunnerError.js +17 -0
- package/local-cli/testCommand/TestRunnerError.test.js +25 -0
- package/local-cli/testCommand/builder.js +0 -1
- package/local-cli/testCommand/middlewares.js +4 -13
- package/local-cli/testCommand/warnings.js +0 -3
- package/local-cli/utils/jestInternals.js +4 -1
- package/package.json +23 -18
- package/runners/deprecation.js +42 -44
- package/runners/jest/globalSetup.js +1 -1
- package/runners/jest/globalTeardown.js +1 -1
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/index.test.js +13 -0
- package/runners/jest/reporters/DetoxReporter.js +33 -2
- package/runners/jest/testEnvironment/index.js +119 -69
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +93 -46
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +13 -15
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -5
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
- package/src/DetoxWorker.js +99 -62
- package/src/android/core/NativeElement.js +56 -20
- package/src/android/core/NativeExpect.js +28 -9
- package/src/android/interactions/native.js +25 -18
- package/src/artifacts/ArtifactsManager.js +14 -47
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- 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/timeline/TimelineContextTypes.js +7 -0
- package/src/artifacts/utils/temporaryPath.js +49 -8
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +19 -2
- package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeAppsConfig.js +4 -0
- package/src/configuration/composeDeviceConfig.js +1 -1
- package/src/configuration/composeLoggerConfig.js +19 -10
- package/src/configuration/composeRunnerConfig.js +14 -9
- package/src/configuration/index.js +5 -1
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +6 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +4 -17
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- package/src/devices/common/drivers/android/exec/ADB.js +4 -0
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
- 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/android/tools/MonitoredInstrumentation.js +1 -1
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +29 -3
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +19 -12
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +10 -2
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +1 -1
- package/src/errors/DetoxConfigErrorComposer.js +14 -1
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +153 -67
- package/src/ipc/IPCClient.js +12 -13
- package/src/ipc/IPCServer.js +28 -24
- package/src/ipc/{state.js → SessionState.js} +26 -53
- package/src/logger/DetoxLogger.js +287 -154
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +115 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +37 -0
- package/src/logger/utils/DetoxLogFinalizer.js +162 -0
- package/src/logger/utils/MessageStack.js +35 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +23 -6
- package/src/logger/utils/getMainCategory.js +5 -0
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/logger/utils/streams/BunyanTransformer.js +72 -0
- package/src/logger/utils/streams/ChromeTraceTransformer.js +127 -0
- package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
- package/src/logger/utils/streams/JSONLStringer.js +55 -0
- package/src/logger/utils/streams/index.js +7 -0
- package/src/logger/utils/streams/transformers.js +39 -0
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxContext.js +79 -65
- package/src/realms/DetoxInternalsFacade.js +8 -12
- package/src/realms/DetoxPrimaryContext.js +104 -70
- package/src/realms/DetoxSecondaryContext.js +29 -32
- 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 +16 -22
- package/src/utils/Timer.js +55 -38
- package/src/utils/argparse.js +11 -0
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/src/utils/errorUtils.js +24 -3
- package/src/utils/invocationTraceDescriptions.js +43 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.3-breaking.new-global-lifecycle.0/detox-20.0.3-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
- package/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/logger/TraceThreadDispatcher.js +0 -52
- package/src/utils/ChromeTracingExporter.js +0 -54
- package/src/utils/streamUtils.js +0 -214
- package/src/utils/trace.js +0 -19
@@ -0,0 +1,25 @@
|
|
1
|
+
const { DetoxError } = require('../../src/errors');
|
2
|
+
|
3
|
+
const TestRunnerError = require('./TestRunnerError');
|
4
|
+
|
5
|
+
describe('TestRunnerError', () => {
|
6
|
+
let error;
|
7
|
+
|
8
|
+
beforeAll(() => {
|
9
|
+
error = new TestRunnerError({ command: 'foo', code: 1, signal: null });
|
10
|
+
});
|
11
|
+
|
12
|
+
it('should format an error message', () => {
|
13
|
+
expect(`${error}`).toMatch(/Command failed with exit code = 1:\nfoo/);
|
14
|
+
});
|
15
|
+
|
16
|
+
it('should assign properties (code, signal)', () => {
|
17
|
+
expect(error.code).toBe(1);
|
18
|
+
expect(error.signal).toBe(null);
|
19
|
+
});
|
20
|
+
|
21
|
+
it('should be formatted to an empty string', () => {
|
22
|
+
// So that the try-catch block in cli.js will not print it for the second time
|
23
|
+
expect(DetoxError.format(error)).toBe('');
|
24
|
+
});
|
25
|
+
});
|
@@ -109,7 +109,6 @@ module.exports = {
|
|
109
109
|
describe: 'Override the device name specified in a configuration. Useful for running a single build configuration on multiple devices.',
|
110
110
|
},
|
111
111
|
'device-boot-args': {
|
112
|
-
alias: 'device-launch-args',
|
113
112
|
group: 'Execution:',
|
114
113
|
describe: 'Custom arguments to pass (through) onto the device (emulator/simulator) binary when booted.',
|
115
114
|
},
|
@@ -5,7 +5,7 @@ const { getJestBooleanArgs } = require('../utils/jestInternals');
|
|
5
5
|
const { simpleUnquote, extractKnownKeys, disengageBooleanArgs } = require('../utils/yargsUtils');
|
6
6
|
|
7
7
|
const testCommandArgs = require('./builder');
|
8
|
-
const { DETOX_ARGV_OVERRIDE_NOTICE
|
8
|
+
const { DETOX_ARGV_OVERRIDE_NOTICE } = require('./warnings');
|
9
9
|
|
10
10
|
function applyEnvironmentVariableAddendum(argv, yargs) {
|
11
11
|
if (process.env.DETOX_ARGV_OVERRIDE) {
|
@@ -13,12 +13,13 @@ function applyEnvironmentVariableAddendum(argv, yargs) {
|
|
13
13
|
|
14
14
|
const { _: positional, '--': passthrough, ...named } = yargs.parse(process.env.DETOX_ARGV_OVERRIDE);
|
15
15
|
|
16
|
-
if (positional) {
|
16
|
+
if (!_.isEmpty(positional)) {
|
17
|
+
/* istanbul ignore next */
|
17
18
|
argv._ = argv._ || [];
|
18
19
|
argv._.push(...positional.map(simpleUnquote));
|
19
20
|
}
|
20
21
|
|
21
|
-
if (passthrough) {
|
22
|
+
if (!_.isEmpty(passthrough)) {
|
22
23
|
argv['--'] = argv['--'] || [];
|
23
24
|
argv['--'].push(...passthrough.map(simpleUnquote));
|
24
25
|
}
|
@@ -29,14 +30,6 @@ function applyEnvironmentVariableAddendum(argv, yargs) {
|
|
29
30
|
return argv;
|
30
31
|
}
|
31
32
|
|
32
|
-
function warnDeviceAppLaunchArgsDeprecation(argv) {
|
33
|
-
if (argv['device-boot-args'] && process.argv.some(a => a.startsWith('--device-launch-args'))) {
|
34
|
-
log.warn(DEVICE_LAUNCH_ARGS_DEPRECATION);
|
35
|
-
}
|
36
|
-
|
37
|
-
return argv;
|
38
|
-
}
|
39
|
-
|
40
33
|
/**
|
41
34
|
* @param {Record<string, *>} argv
|
42
35
|
* @returns {{
|
@@ -64,12 +57,10 @@ function splitArgv(argv) {
|
|
64
57
|
// noinspection JSUnusedGlobalSymbols
|
65
58
|
module.exports = {
|
66
59
|
applyEnvironmentVariableAddendum,
|
67
|
-
warnDeviceAppLaunchArgsDeprecation,
|
68
60
|
splitArgv,
|
69
61
|
};
|
70
62
|
|
71
63
|
module.exports.default = [
|
72
64
|
applyEnvironmentVariableAddendum,
|
73
|
-
warnDeviceAppLaunchArgsDeprecation,
|
74
65
|
splitArgv,
|
75
66
|
];
|
@@ -1,5 +1,3 @@
|
|
1
|
-
const { DEVICE_LAUNCH_ARGS_DEPRECATION } = require('../../src/configuration/utils/warnings');
|
2
|
-
|
3
1
|
const DETOX_ARGV_OVERRIDE_NOTICE = `
|
4
2
|
_____ _____ ___________
|
5
3
|
/ ___|_ _| _ | ___ \\ $DETOX_ARGV_OVERRIDE is detected
|
@@ -22,5 +20,4 @@ const DETOX_ARGV_OVERRIDE_NOTICE = `
|
|
22
20
|
|
23
21
|
module.exports = {
|
24
22
|
DETOX_ARGV_OVERRIDE_NOTICE,
|
25
|
-
DEVICE_LAUNCH_ARGS_DEPRECATION,
|
26
23
|
};
|
@@ -4,6 +4,7 @@ const path = require('path');
|
|
4
4
|
|
5
5
|
const _ = require('lodash');
|
6
6
|
const resolveFrom = require('resolve-from');
|
7
|
+
const semver = require('semver');
|
7
8
|
|
8
9
|
const { DetoxRuntimeError } = require('../../src/errors');
|
9
10
|
|
@@ -50,7 +51,9 @@ function resolveJestCliArgs() {
|
|
50
51
|
|
51
52
|
try {
|
52
53
|
const jestCliManifest = resolveJestDependency(jestLocation, 'jest-cli/package.json');
|
53
|
-
const
|
54
|
+
const jestCliVersion = require(jestCliManifest).version;
|
55
|
+
const argsJsFilePath = semver.gt(jestCliVersion, '29.1.2') ? 'build/args.js' : 'build/cli/args.js';
|
56
|
+
const argsJsFile = path.join(path.dirname(jestCliManifest), argsJsFilePath);
|
54
57
|
|
55
58
|
return require(argsJsFile);
|
56
59
|
} catch (e) {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "detox",
|
3
3
|
"description": "E2E tests and automation for mobile",
|
4
|
-
"version": "20.0.3
|
4
|
+
"version": "20.0.3",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -35,8 +35,8 @@
|
|
35
35
|
"@types/bunyan": "^1.8.8",
|
36
36
|
"@types/child-process-promise": "^2.2.1",
|
37
37
|
"@types/fs-extra": "^9.0.13",
|
38
|
-
"@types/jest": "^
|
39
|
-
"@types/node": "^
|
38
|
+
"@types/jest": "^28.1.8",
|
39
|
+
"@types/node": "^14.18.33",
|
40
40
|
"@types/node-ipc": "^9.2.0",
|
41
41
|
"@types/ws": "^7.4.0",
|
42
42
|
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
@@ -46,10 +46,10 @@
|
|
46
46
|
"eslint-plugin-no-only-tests": "^2.6.0",
|
47
47
|
"eslint-plugin-node": "^11.1.0",
|
48
48
|
"eslint-plugin-unicorn": "^39.0.0",
|
49
|
-
"jest": "^28.
|
49
|
+
"jest": "^28.1.3",
|
50
50
|
"mockdate": "^2.0.1",
|
51
51
|
"prettier": "1.7.0",
|
52
|
-
"react-native": "0.
|
52
|
+
"react-native": "0.69.7",
|
53
53
|
"react-native-codegen": "^0.0.8",
|
54
54
|
"typescript": "^4.5.2",
|
55
55
|
"wtfnode": "^0.9.1"
|
@@ -57,13 +57,14 @@
|
|
57
57
|
"dependencies": {
|
58
58
|
"ajv": "^8.6.3",
|
59
59
|
"bunyan": "^1.8.12",
|
60
|
-
"bunyan-debug-stream": "^3.0
|
60
|
+
"bunyan-debug-stream": "^3.1.0",
|
61
|
+
"caf": "^15.0.1",
|
61
62
|
"chalk": "^2.4.2",
|
62
63
|
"child-process-promise": "^2.2.0",
|
63
|
-
"duplexify": "^4.1.2",
|
64
64
|
"find-up": "^4.1.0",
|
65
65
|
"fs-extra": "^4.0.2",
|
66
|
-
"funpermaproxy": "^1.0
|
66
|
+
"funpermaproxy": "^1.1.0",
|
67
|
+
"glob": "^8.0.3",
|
67
68
|
"ini": "^1.3.4",
|
68
69
|
"json-cycle": "^1.3.0",
|
69
70
|
"lodash": "^4.17.5",
|
@@ -80,10 +81,9 @@
|
|
80
81
|
"signal-exit": "^3.0.3",
|
81
82
|
"stream-json": "^1.7.4",
|
82
83
|
"strip-ansi": "^6.0.1",
|
83
|
-
"tail": "^2.0.0",
|
84
84
|
"telnet-client": "1.2.8",
|
85
85
|
"tempfile": "^2.0.0",
|
86
|
-
"trace-event-lib": "^1.1
|
86
|
+
"trace-event-lib": "^1.3.1",
|
87
87
|
"which": "^1.3.1",
|
88
88
|
"ws": "^7.0.0",
|
89
89
|
"yargs": "^16.0.3",
|
@@ -91,7 +91,7 @@
|
|
91
91
|
"yargs-unparser": "^2.0.0"
|
92
92
|
},
|
93
93
|
"peerDependencies": {
|
94
|
-
"jest": "28.x.x || ^27.2.5"
|
94
|
+
"jest": "29.x.x || 28.x.x || ^27.2.5"
|
95
95
|
},
|
96
96
|
"peerDependenciesMeta": {
|
97
97
|
"jest": {
|
@@ -99,7 +99,7 @@
|
|
99
99
|
}
|
100
100
|
},
|
101
101
|
"engines": {
|
102
|
-
"node": ">=
|
102
|
+
"node": ">=14.5.0"
|
103
103
|
},
|
104
104
|
"jest": {
|
105
105
|
"setupFiles": [
|
@@ -158,7 +158,12 @@
|
|
158
158
|
"src/utils/pipeCommands.js",
|
159
159
|
"src/utils/pressAnyKey.js",
|
160
160
|
"src/utils/shellUtils.js",
|
161
|
-
"runners/jest
|
161
|
+
"runners/jest/reporters",
|
162
|
+
"runners/jest/testEnvironment",
|
163
|
+
"src/DetoxWorker.js",
|
164
|
+
"src/logger/utils/streamUtils.js",
|
165
|
+
"src/ipc",
|
166
|
+
"src/realms"
|
162
167
|
],
|
163
168
|
"resetMocks": true,
|
164
169
|
"resetModules": true,
|
@@ -176,12 +181,12 @@
|
|
176
181
|
],
|
177
182
|
"coverageThreshold": {
|
178
183
|
"global": {
|
179
|
-
"statements":
|
180
|
-
"branches":
|
181
|
-
"functions":
|
182
|
-
"lines":
|
184
|
+
"statements": 100,
|
185
|
+
"branches": 100,
|
186
|
+
"functions": 100,
|
187
|
+
"lines": 100
|
183
188
|
}
|
184
189
|
}
|
185
190
|
},
|
186
|
-
"gitHead": "
|
191
|
+
"gitHead": "f1deb8295fe06bf9e8f45116f85d21fdb37b7b47"
|
187
192
|
}
|
package/runners/deprecation.js
CHANGED
@@ -1,47 +1,45 @@
|
|
1
1
|
const chalk = require('chalk');
|
2
2
|
|
3
3
|
// @ts-ignore
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
throw
|
46
|
-
'\n\nPlease follow the new Jest setup guide:\nhttps://github.com/wix/Detox/blob/master/docs/Guide.Jest.md\n\n'
|
47
|
-
), { stack: '' });
|
4
|
+
const bold = chalk.bold;
|
5
|
+
|
6
|
+
function getMaxWidth(text) {
|
7
|
+
const lines = text.split('\n');
|
8
|
+
return lines.reduce((acc, line) => Math.max(acc, line.length), 0);
|
9
|
+
}
|
10
|
+
|
11
|
+
function centerText(text, maxWidth = getMaxWidth(text)) {
|
12
|
+
return text
|
13
|
+
.split('\n')
|
14
|
+
.map(line => {
|
15
|
+
const padStart = Math.max(0, Math.floor((maxWidth - line.length) / 2));
|
16
|
+
const padEnd = Math.max(0, maxWidth - line.length - padStart);
|
17
|
+
return ' '.repeat(padStart) + line + ' '.repeat(padEnd);
|
18
|
+
})
|
19
|
+
.join('\n');
|
20
|
+
}
|
21
|
+
|
22
|
+
const header = `\
|
23
|
+
========================= THE NEW JOURNEY BEGINS =============================`;
|
24
|
+
|
25
|
+
console.error(centerText(`\
|
26
|
+
|
27
|
+
${bold(header)}
|
28
|
+
|
29
|
+
https://wix.github.io/Detox/docs/guide/migration
|
30
|
+
|
31
|
+
Sorry to say that Detox 20 comes without old adapters for Jest.
|
32
|
+
You have to rearrange your init code before you can continue your journey.
|
33
|
+
|
34
|
+
Navigate to the link and follow the migration guide steps.
|
35
|
+
|
36
|
+
Sincerely yours,
|
37
|
+
Detox team.
|
38
|
+
|
39
|
+
${bold(header)}
|
40
|
+
|
41
|
+
`, header.length));
|
42
|
+
|
43
|
+
const error = new Error('\nPlease follow the migration guide:\nhttps://wix.github.io/Detox/docs/guide/migration\n\n');
|
44
|
+
error.stack = '';
|
45
|
+
throw error;
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = async () => require('../../internals').
|
1
|
+
module.exports = async () => require('../../internals').init({ workerId: null });
|
@@ -1 +1 @@
|
|
1
|
-
module.exports = async () => require('../../internals').
|
1
|
+
module.exports = async () => require('../../internals').cleanup();
|
@@ -0,0 +1,60 @@
|
|
1
|
+
declare module 'detox/runners/jest' {
|
2
|
+
import type NodeEnvironment from 'jest-environment-node';
|
3
|
+
|
4
|
+
export function globalSetup(): Promise<void>;
|
5
|
+
export function globalTeardown(): Promise<void>;
|
6
|
+
|
7
|
+
export type DetoxCircusListenerConstructorOpts = {
|
8
|
+
readonly env: DetoxCircusEnvironment;
|
9
|
+
}
|
10
|
+
|
11
|
+
/**
|
12
|
+
* @example
|
13
|
+
* class CustomListener implements DetoxCircusListener {
|
14
|
+
* constructor(opts: DetoxCircusListenerConstructorOpts) {
|
15
|
+
* console.log('Current test path is:', opts.env.testPath);
|
16
|
+
* }
|
17
|
+
* }
|
18
|
+
*/
|
19
|
+
export interface DetoxCircusListener {
|
20
|
+
start_describe_definition?(event: unknown, state: unknown): void;
|
21
|
+
finish_describe_definition?(event: unknown, state: unknown): void;
|
22
|
+
add_hook?(event: unknown, state: unknown): void;
|
23
|
+
add_test?(event: unknown, state: unknown): void;
|
24
|
+
error?(event: unknown, state: unknown): void;
|
25
|
+
|
26
|
+
setup?(event: unknown, state: unknown): void | Promise<void>;
|
27
|
+
include_test_location_in_result?(event: unknown, state: unknown): void | Promise<void>;
|
28
|
+
hook_start?(event: unknown, state: unknown): void | Promise<void>;
|
29
|
+
hook_success?(event: unknown, state: unknown): void | Promise<void>;
|
30
|
+
hook_failure?(event: unknown, state: unknown): void | Promise<void>;
|
31
|
+
test_fn_start?(event: unknown, state: unknown): void | Promise<void>;
|
32
|
+
test_fn_success?(event: unknown, state: unknown): void | Promise<void>;
|
33
|
+
test_fn_failure?(event: unknown, state: unknown): void | Promise<void>;
|
34
|
+
test_retry?(event: unknown, state: unknown): void | Promise<void>;
|
35
|
+
test_start?(event: unknown, state: unknown): void | Promise<void>;
|
36
|
+
test_skip?(event: unknown, state: unknown): void | Promise<void>;
|
37
|
+
test_todo?(event: unknown, state: unknown): void | Promise<void>;
|
38
|
+
test_done?(event: unknown, state: unknown): void | Promise<void>;
|
39
|
+
run_describe_start?(event: unknown, state: unknown): void | Promise<void>;
|
40
|
+
run_describe_finish?(event: unknown, state: unknown): void | Promise<void>;
|
41
|
+
run_start?(event: unknown, state: unknown): void | Promise<void>;
|
42
|
+
run_finish?(event: unknown, state: unknown): void | Promise<void>;
|
43
|
+
teardown?(event: unknown, state: unknown): void | Promise<void>;
|
44
|
+
}
|
45
|
+
|
46
|
+
export interface DetoxListenerFactory {
|
47
|
+
new (opts: DetoxCircusListenerConstructorOpts): DetoxCircusListener;
|
48
|
+
}
|
49
|
+
|
50
|
+
export class DetoxCircusEnvironment extends NodeEnvironment {
|
51
|
+
public readonly handleTestEvent: (event: unknown, state: unknown) => void | Promise<void>;
|
52
|
+
public readonly testPath: string;
|
53
|
+
|
54
|
+
protected registerListeners(map: Record<string, DetoxListenerFactory>): void;
|
55
|
+
protected setupTimeout: number;
|
56
|
+
protected teardownTimeout: number;
|
57
|
+
protected initDetox(): Promise<DetoxInternals.Worker>;
|
58
|
+
protected cleanupDetox(): Promise<void>;
|
59
|
+
}
|
60
|
+
}
|
package/runners/jest/index.js
CHANGED
@@ -1,14 +1,11 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// Lazy require() is used to avoid initializing a bare Detox context when it is not needed.
|
2
|
+
// At the moment, this safety measure is not really needed, but it's better to be on the safe side.
|
3
3
|
|
4
|
+
module.exports = {
|
4
5
|
get DetoxCircusEnvironment() {
|
5
6
|
return require('./testEnvironment');
|
6
7
|
},
|
7
8
|
|
8
|
-
//#endregion
|
9
|
-
|
10
|
-
//#region *** Worker Realm ***
|
11
|
-
|
12
9
|
get globalSetup() {
|
13
10
|
return require('./globalSetup');
|
14
11
|
},
|
@@ -16,6 +13,4 @@ module.exports = {
|
|
16
13
|
get globalTeardown() {
|
17
14
|
return require('./globalTeardown');
|
18
15
|
},
|
19
|
-
|
20
|
-
//#endregion
|
21
16
|
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
describe('detox/runners/jest', () => {
|
2
|
+
it('should lazily require the exported modules', () => {
|
3
|
+
const index = require('./index');
|
4
|
+
|
5
|
+
jest.mock('./testEnvironment', () => 0);
|
6
|
+
jest.mock('./globalSetup', () => 1);
|
7
|
+
jest.mock('./globalTeardown', () => 2);
|
8
|
+
|
9
|
+
expect(index.DetoxCircusEnvironment).toBe(0);
|
10
|
+
expect(index.globalSetup).toBe(1);
|
11
|
+
expect(index.globalTeardown).toBe(2);
|
12
|
+
});
|
13
|
+
});
|
@@ -1,5 +1,36 @@
|
|
1
|
-
const
|
1
|
+
const resolveFrom = require('resolve-from');
|
2
|
+
/** @type {typeof import('@jest/reporters').VerboseReporter} */
|
3
|
+
const JestVerboseReporter = require(resolveFrom(process.cwd(), '@jest/reporters')).VerboseReporter;
|
2
4
|
|
3
|
-
|
5
|
+
const { config, reportTestResults } = require('../../../internals');
|
6
|
+
|
7
|
+
class DetoxReporter extends JestVerboseReporter {
|
8
|
+
/**
|
9
|
+
* @param {import('@jest/test-result').AggregatedResult} results
|
10
|
+
*/
|
11
|
+
// @ts-ignore
|
12
|
+
async onRunComplete(_contexts, results) {
|
13
|
+
// @ts-ignore
|
14
|
+
await super.onRunComplete(_contexts, results);
|
15
|
+
|
16
|
+
await reportTestResults(results.testResults.map(r => ({
|
17
|
+
success: !r.failureMessage,
|
18
|
+
testFilePath: r.testFilePath,
|
19
|
+
testExecError: r.testExecError,
|
20
|
+
isPermanentFailure: this._isPermanentFailure(r),
|
21
|
+
})));
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* @param {import('@jest/test-result').TestResult} testResult
|
26
|
+
*/
|
27
|
+
_isPermanentFailure(testResult) {
|
28
|
+
if (config.testRunner.jest.retryAfterCircusRetries) {
|
29
|
+
return false;
|
30
|
+
}
|
31
|
+
|
32
|
+
return testResult.testResults.some(r => r.status === 'failed' && r.invocations > 1);
|
33
|
+
}
|
34
|
+
}
|
4
35
|
|
5
36
|
module.exports = DetoxReporter;
|