detox 20.0.14-next-is-hittable-check-2.0 → 20.0.14-prerelease.0
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.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar} +0 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom → 20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.14-prerelease.0/detox-20.0.14-prerelease.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/index.d.ts +3 -4
- package/internals.d.ts +26 -5
- package/local-cli/cli.js +1 -1
- package/local-cli/init.js +1 -1
- package/local-cli/test.js +6 -6
- package/local-cli/test.test.js +14 -18
- package/local-cli/testCommand/TestRunnerCommand.js +75 -86
- package/local-cli/testCommand/builder.js +0 -1
- package/local-cli/testCommand/middlewares.js +1 -11
- package/local-cli/testCommand/warnings.js +0 -3
- package/package.json +22 -8
- package/runners/deprecation.js +42 -44
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/reporters/DetoxReporter.js +21 -10
- package/runners/jest/testEnvironment/index.js +57 -41
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +7 -3
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +12 -14
- 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 +84 -46
- package/src/artifacts/ArtifactsManager.js +6 -6
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeRunnerConfig.js +4 -3
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/ipc/SessionState.js +7 -5
- package/src/logger/DetoxLogger.js +1 -19
- package/src/logger/index.js +1 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +7 -29
- package/src/logger/utils/DetoxLogFinalizer.js +134 -0
- package/src/logger/utils/ThreadDispatcher.js +5 -25
- package/src/logger/utils/customConsoleLogger.js +4 -3
- package/src/logger/utils/streamUtils.js +34 -26
- package/src/realms/DetoxContext.js +8 -7
- package/src/realms/DetoxPrimaryContext.js +22 -82
- package/src/realms/DetoxSecondaryContext.js +0 -8
- package/src/utils/argparse.js +11 -0
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.14-next-is-hittable-check-2.0/detox-20.0.14-next-is-hittable-check-2.0.pom.sha512 +0 -1
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
@@ -25,20 +25,20 @@ function getStackDump() {
|
|
25
25
|
|
26
26
|
function proxyLog(bunyanLoggerFn) {
|
27
27
|
return (...args) => {
|
28
|
-
bunyanLoggerFn({ origin: getOrigin() }, util.format(...args));
|
28
|
+
bunyanLoggerFn({ cat: 'user', origin: getOrigin() }, util.format(...args));
|
29
29
|
};
|
30
30
|
}
|
31
31
|
|
32
32
|
function proxyTracing(bunyanLoggerFn) {
|
33
33
|
return (...args) => {
|
34
|
-
bunyanLoggerFn({ origin: getOrigin(), stack: getStackDump() }, util.format(...args));
|
34
|
+
bunyanLoggerFn({ cat: 'user', origin: getOrigin(), stack: getStackDump() }, util.format(...args));
|
35
35
|
};
|
36
36
|
}
|
37
37
|
|
38
38
|
function proxyAssert(bunyanLoggerFn) {
|
39
39
|
return (condition, ...args) => {
|
40
40
|
if (!condition) {
|
41
|
-
bunyanLoggerFn({ origin: getOrigin() }, 'AssertionError:', util.format(...args));
|
41
|
+
bunyanLoggerFn({ cat: 'user', origin: getOrigin() }, 'AssertionError:', util.format(...args));
|
42
42
|
}
|
43
43
|
};
|
44
44
|
}
|
@@ -48,6 +48,7 @@ function overrideConsoleMethods(console, bunyanLogger) {
|
|
48
48
|
const log = bunyanLogger;
|
49
49
|
|
50
50
|
override(console, 'log', log.info.bind(log));
|
51
|
+
override(console, 'info', log.info.bind(log));
|
51
52
|
override(console, 'warn', log.warn.bind(log));
|
52
53
|
override(console, 'trace', log.info.bind(log));
|
53
54
|
override(console, 'error', log.error.bind(log));
|
@@ -3,14 +3,12 @@ const { PassThrough, Transform } = require('stream');
|
|
3
3
|
const bunyanDebugStream = require('bunyan-debug-stream');
|
4
4
|
const duplexify = require('duplexify');
|
5
5
|
const fs = require('fs-extra');
|
6
|
-
const glob = require('glob');
|
7
6
|
const multiSort = require('multi-sort-stream');
|
8
7
|
const pipe = require('multipipe');
|
9
8
|
const JsonlParser = require('stream-json/jsonl/Parser');
|
10
9
|
const stripAnsi = require('strip-ansi');
|
11
10
|
const { AbstractEventBuilder } = require('trace-event-lib');
|
12
11
|
|
13
|
-
const temporary = require('../../artifacts/utils/temporaryPath');
|
14
12
|
const log = require('../../utils/logger').child({ cat: 'logger' });
|
15
13
|
|
16
14
|
function compareTimestamps(a, b) {
|
@@ -143,27 +141,49 @@ class SimpleEventBuilder extends AbstractEventBuilder {
|
|
143
141
|
}
|
144
142
|
}
|
145
143
|
|
146
|
-
|
144
|
+
const ERROR_TID = 37707;
|
145
|
+
|
146
|
+
function getTidHash({ pid, tid, cat }) {
|
147
|
+
const mainCategory = String(cat).split(',')[0];
|
148
|
+
return `${pid}:${mainCategory}:${tid}`;
|
149
|
+
}
|
150
|
+
|
151
|
+
function getFixedTID(tidHashMap, event) {
|
152
|
+
let tid = tidHashMap.get(getTidHash(event));
|
153
|
+
if (tid === undefined) {
|
154
|
+
tid = ERROR_TID;
|
155
|
+
}
|
156
|
+
|
157
|
+
return tid;
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
* @param {Map<string, number>} [tidHashMap]
|
162
|
+
*/
|
163
|
+
function chromeTraceStream(tidHashMap) {
|
147
164
|
const knownPids = new Set();
|
148
165
|
const knownTids = new Set();
|
166
|
+
const fixTID = tidHashMap ? getFixedTID.bind(null, tidHashMap) : (x) => x.tid;
|
149
167
|
|
150
168
|
return flatMapTransform((data) => {
|
151
169
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
152
|
-
const { cat
|
170
|
+
const { cat: rawCat, msg: name, ph = 'i', pid, tid: _tid, time, name: _name, hostname: _hostname, ...args } = data;
|
153
171
|
const ts = new Date(time).getTime() * 1E3;
|
172
|
+
const cat = rawCat || 'undefined';
|
173
|
+
const tid = fixTID(data);
|
154
174
|
|
155
175
|
const builder = new SimpleEventBuilder();
|
156
176
|
if (!knownPids.has(pid)) {
|
157
|
-
builder.
|
177
|
+
builder.metadata({ pid, ts, name: 'process_name', args: { name: pid === process.pid ? 'primary' : 'secondary' } });
|
178
|
+
builder.metadata({ pid, ts, name: 'process_sort_index', args: { sort_index: knownPids.size } });
|
158
179
|
knownPids.add(pid);
|
159
180
|
}
|
160
181
|
|
161
|
-
|
162
|
-
if (!knownTids.has(tidHash)) {
|
182
|
+
if (!knownTids.has(tid)) {
|
163
183
|
const primaryCategory = cat.split(',', 1)[0];
|
164
|
-
builder.
|
165
|
-
builder.
|
166
|
-
knownTids.add(
|
184
|
+
builder.metadata({ pid, tid, ts, name: 'thread_name', args: { name: primaryCategory } });
|
185
|
+
builder.metadata({ pid, tid, ts, name: 'thread_sort_index', args: { sort_index: tid } });
|
186
|
+
knownTids.add(tid);
|
167
187
|
}
|
168
188
|
|
169
189
|
const event = { ph, name, pid, tid, cat, ts, args };
|
@@ -207,25 +227,13 @@ function readJSONL() {
|
|
207
227
|
}
|
208
228
|
|
209
229
|
/**
|
210
|
-
* @param {string}
|
230
|
+
* @param {string[]} logs
|
211
231
|
* @returns {NodeJS.ReadableStream}
|
212
232
|
*/
|
213
|
-
function uniteSessionLogs(
|
233
|
+
function uniteSessionLogs(logs) {
|
214
234
|
const readable = through();
|
215
|
-
|
216
|
-
|
217
|
-
if (err) {
|
218
|
-
return readable.emit('error', err);
|
219
|
-
}
|
220
|
-
|
221
|
-
if (logs.length === 0) {
|
222
|
-
return;
|
223
|
-
}
|
224
|
-
|
225
|
-
const jsonlStreams = logs.map(filePath => fs.createReadStream(filePath).pipe(readJSONL()));
|
226
|
-
mergeSortedJSONL(jsonlStreams).pipe(readable);
|
227
|
-
});
|
228
|
-
|
235
|
+
const jsonlStreams = logs.map(filePath => fs.createReadStream(filePath).pipe(readJSONL()));
|
236
|
+
mergeSortedJSONL(jsonlStreams).pipe(readable);
|
229
237
|
return readable;
|
230
238
|
}
|
231
239
|
|
@@ -2,13 +2,14 @@ const funpermaproxy = require('funpermaproxy');
|
|
2
2
|
|
3
3
|
const temporary = require('../artifacts/utils/temporaryPath');
|
4
4
|
const { DetoxRuntimeError } = require('../errors');
|
5
|
-
const { DetoxLogger, installLegacyTracerInterface } = require('../logger');
|
5
|
+
const { DetoxLogger, DetoxLogFinalizer, installLegacyTracerInterface } = require('../logger');
|
6
6
|
const symbols = require('../symbols');
|
7
7
|
|
8
8
|
const DetoxConstants = require('./DetoxConstants');
|
9
9
|
|
10
10
|
//#region Protected symbols
|
11
11
|
const $cleanup = Symbol('cleanup');
|
12
|
+
const $logFinalizer = Symbol('logFinalizer');
|
12
13
|
const $restoreSessionState = Symbol('restoreSessionState');
|
13
14
|
const $sessionState = Symbol('restoreSessionState');
|
14
15
|
const $status = Symbol('status');
|
@@ -58,6 +59,10 @@ class DetoxContext {
|
|
58
59
|
this.log = this[symbols.logger].child({ cat: 'user' });
|
59
60
|
installLegacyTracerInterface(this.log, this);
|
60
61
|
|
62
|
+
this[$logFinalizer] = new DetoxLogFinalizer({
|
63
|
+
session: this[$sessionState]
|
64
|
+
});
|
65
|
+
|
61
66
|
/** @type {import('../DetoxWorker') | null} */
|
62
67
|
this[$worker] = null;
|
63
68
|
}
|
@@ -91,12 +96,7 @@ class DetoxContext {
|
|
91
96
|
[symbols.config] = funpermaproxy(() => this[symbols.session].detoxConfig);
|
92
97
|
[symbols.session] = funpermaproxy(() => this[$sessionState]);
|
93
98
|
[symbols.tracing] = Object.freeze({
|
94
|
-
createEventStream: () =>
|
95
|
-
const streamUtils = require('../logger/utils/streamUtils');
|
96
|
-
return streamUtils
|
97
|
-
.uniteSessionLogs(this[$sessionState].id)
|
98
|
-
.pipe(streamUtils.chromeTraceStream());
|
99
|
-
},
|
99
|
+
createEventStream: () => this[$logFinalizer].createEventStream(),
|
100
100
|
});
|
101
101
|
/** @abstract */
|
102
102
|
[symbols.reportTestResults](_testResults) {}
|
@@ -175,6 +175,7 @@ class DetoxContext {
|
|
175
175
|
module.exports = DetoxContext;
|
176
176
|
module.exports.protected = {
|
177
177
|
$cleanup,
|
178
|
+
$logFinalizer,
|
178
179
|
$restoreSessionState,
|
179
180
|
$status,
|
180
181
|
$sessionState,
|
@@ -1,36 +1,29 @@
|
|
1
|
-
const path = require('path');
|
2
1
|
const { URL } = require('url');
|
3
|
-
const { promisify } = require('util');
|
4
2
|
|
5
3
|
const fs = require('fs-extra');
|
6
|
-
const glob = require('glob');
|
7
|
-
const pipe = require('multipipe');
|
8
4
|
const onSignalExit = require('signal-exit');
|
9
5
|
|
10
6
|
const temporary = require('../artifacts/utils/temporaryPath');
|
11
7
|
const { DetoxRuntimeError } = require('../errors');
|
12
8
|
const SessionState = require('../ipc/SessionState');
|
13
9
|
const symbols = require('../symbols');
|
14
|
-
|
15
|
-
const
|
16
|
-
const globSync = glob.sync;
|
10
|
+
const { getCurrentCommand } = require('../utils/argparse');
|
11
|
+
const uuid = require('../utils/uuid');
|
17
12
|
|
18
13
|
const DetoxContext = require('./DetoxContext');
|
19
14
|
|
20
15
|
// Protected symbols
|
21
|
-
const { $restoreSessionState, $sessionState, $worker } = DetoxContext.protected;
|
16
|
+
const { $logFinalizer, $restoreSessionState, $sessionState, $worker } = DetoxContext.protected;
|
22
17
|
|
23
18
|
//#region Private symbols
|
24
|
-
const _finalizeLogs = Symbol('finalizeLogs');
|
25
|
-
const _finalizeLogsSync = Symbol('finalizeLogsSync');
|
26
19
|
const _globalLifecycleHandler = Symbol('globalLifecycleHandler');
|
27
20
|
const _ipcServer = Symbol('ipcServer');
|
28
21
|
const _resetLockFile = Symbol('resetLockFile');
|
29
22
|
const _wss = Symbol('wss');
|
30
23
|
const _dirty = Symbol('dirty');
|
31
24
|
const _emergencyTeardown = Symbol('emergencyTeardown');
|
32
|
-
const _areLogsEnabled = Symbol('areLogsEnabled');
|
33
25
|
const _lifecycleLogger = Symbol('lifecycleLogger');
|
26
|
+
const _sessionFile = Symbol('sessionFile');
|
34
27
|
//#endregion
|
35
28
|
|
36
29
|
class DetoxPrimaryContext extends DetoxContext {
|
@@ -40,6 +33,8 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
40
33
|
this[_dirty] = false;
|
41
34
|
this[_wss] = null;
|
42
35
|
this[_globalLifecycleHandler] = null;
|
36
|
+
/** Path to file where the initial session object is serialized */
|
37
|
+
this[_sessionFile] = '';
|
43
38
|
/**
|
44
39
|
* @type {import('../ipc/IPCServer') | null}
|
45
40
|
*/
|
@@ -91,8 +86,9 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
91
86
|
await this[symbols.logger].setConfig(loggerConfig);
|
92
87
|
|
93
88
|
this[_lifecycleLogger].trace.begin({
|
89
|
+
cwd: process.cwd(),
|
94
90
|
data: this[$sessionState],
|
95
|
-
},
|
91
|
+
}, getCurrentCommand());
|
96
92
|
|
97
93
|
const IPCServer = require('../ipc/IPCServer');
|
98
94
|
this[_ipcServer] = new IPCServer({
|
@@ -130,8 +126,10 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
130
126
|
sessionConfig.server = `ws://localhost:${this[_wss].port}`;
|
131
127
|
}
|
132
128
|
|
133
|
-
|
134
|
-
|
129
|
+
this[_sessionFile] = temporary.for.json(this[$sessionState].id);
|
130
|
+
await fs.writeFile(this[_sessionFile], this[$sessionState].stringify());
|
131
|
+
process.env.DETOX_CONFIG_SNAPSHOT_PATH = this[_sessionFile];
|
132
|
+
this[_lifecycleLogger].trace(`Serialized the session state at: ${this[_sessionFile]}`);
|
135
133
|
|
136
134
|
if (opts.workerId !== null) {
|
137
135
|
await this[symbols.installWorker](opts);
|
@@ -173,12 +171,14 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
173
171
|
this[_ipcServer] = null;
|
174
172
|
}
|
175
173
|
|
176
|
-
|
174
|
+
if (this[_sessionFile]) {
|
175
|
+
await fs.remove(this[_sessionFile]);
|
176
|
+
}
|
177
177
|
|
178
178
|
if (this[_dirty]) {
|
179
179
|
try {
|
180
180
|
this[_lifecycleLogger].trace.end();
|
181
|
-
await this[
|
181
|
+
await this[$logFinalizer].finalize();
|
182
182
|
} catch (err) {
|
183
183
|
this[_lifecycleLogger].error({ err }, 'Encountered an error while merging the process logs:');
|
184
184
|
}
|
@@ -204,9 +204,13 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
204
204
|
this[_ipcServer].dispose();
|
205
205
|
}
|
206
206
|
|
207
|
+
if (this[_sessionFile]) {
|
208
|
+
fs.removeSync(this[_sessionFile]);
|
209
|
+
}
|
210
|
+
|
207
211
|
try {
|
208
212
|
this[_lifecycleLogger].trace.end({ abortSignal: signal });
|
209
|
-
this[
|
213
|
+
this[$logFinalizer].finalizeSync();
|
210
214
|
} catch (err) {
|
211
215
|
this[symbols.logger].error({ err }, 'Encountered an error while merging the process logs:');
|
212
216
|
}
|
@@ -222,77 +226,13 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
222
226
|
*/
|
223
227
|
[$restoreSessionState]() {
|
224
228
|
return new SessionState({
|
225
|
-
|
229
|
+
id: uuid.UUID(),
|
226
230
|
detoxIPCServer: `primary-${process.pid}`,
|
227
231
|
});
|
228
232
|
}
|
229
233
|
//#endregion
|
230
234
|
|
231
235
|
//#region Private members
|
232
|
-
async[_finalizeLogs]() {
|
233
|
-
const sessionId = this[$sessionState].id;
|
234
|
-
const logs = await globAsync(temporary.for.jsonl(`${sessionId}.*`));
|
235
|
-
if (logs.length === 0) {
|
236
|
-
return;
|
237
|
-
}
|
238
|
-
|
239
|
-
if (this[_areLogsEnabled]()) {
|
240
|
-
const streamUtils = require('../logger/utils/streamUtils');
|
241
|
-
const { rootDir } = this[symbols.config].artifacts;
|
242
|
-
|
243
|
-
await fs.mkdirp(rootDir);
|
244
|
-
const [out1Stream, out2Stream] = ['detox.log', 'detox.trace.json']
|
245
|
-
.map((filename) => fs.createWriteStream(path.join(rootDir, filename)));
|
246
|
-
|
247
|
-
const mergedStream = streamUtils.uniteSessionLogs(sessionId);
|
248
|
-
|
249
|
-
await Promise.all([
|
250
|
-
pipe(mergedStream, streamUtils.debugStream(this[symbols.logger].config.options), out1Stream),
|
251
|
-
pipe(mergedStream, streamUtils.chromeTraceStream(), streamUtils.writeJSON(), out2Stream),
|
252
|
-
]);
|
253
|
-
}
|
254
|
-
|
255
|
-
await Promise.all(logs.map(filepath => fs.remove(filepath)));
|
256
|
-
}
|
257
|
-
|
258
|
-
async[_finalizeLogsSync]() {
|
259
|
-
const logsEnabled = this[_areLogsEnabled]();
|
260
|
-
|
261
|
-
const { rootDir } = this[symbols.config].artifacts;
|
262
|
-
|
263
|
-
if (logsEnabled) {
|
264
|
-
fs.mkdirpSync(rootDir);
|
265
|
-
}
|
266
|
-
|
267
|
-
const sessionId = this[$sessionState].id;
|
268
|
-
const logs = globSync(temporary.for.jsonl(`${sessionId}.*`));
|
269
|
-
|
270
|
-
for (const log of logs) {
|
271
|
-
if (logsEnabled) {
|
272
|
-
fs.moveSync(log, path.join(rootDir, path.basename(log)));
|
273
|
-
} else {
|
274
|
-
fs.removeSync(log);
|
275
|
-
}
|
276
|
-
}
|
277
|
-
}
|
278
|
-
|
279
|
-
[_areLogsEnabled]() {
|
280
|
-
const { rootDir, plugins } = this[symbols.config].artifacts || {};
|
281
|
-
if (!rootDir || !plugins) {
|
282
|
-
return false;
|
283
|
-
}
|
284
|
-
|
285
|
-
if (!plugins.log.enabled) {
|
286
|
-
return false;
|
287
|
-
}
|
288
|
-
|
289
|
-
if (!plugins.log.keepOnlyFailedTestsArtifacts) {
|
290
|
-
return true;
|
291
|
-
}
|
292
|
-
|
293
|
-
return this[$sessionState].testResults.some(r => !r.success);
|
294
|
-
}
|
295
|
-
|
296
236
|
async[_resetLockFile]() {
|
297
237
|
const DeviceRegistry = require('../devices/DeviceRegistry');
|
298
238
|
|
@@ -11,7 +11,6 @@ const { $restoreSessionState, $sessionState, $worker } = DetoxContext.protected;
|
|
11
11
|
|
12
12
|
//#region Private symbols
|
13
13
|
const _ipcClient = Symbol('ipcClient');
|
14
|
-
const _shortLifecycle = Symbol('shortLifecycle');
|
15
14
|
//#endregion
|
16
15
|
|
17
16
|
class DetoxSecondaryContext extends DetoxContext {
|
@@ -23,13 +22,6 @@ class DetoxSecondaryContext extends DetoxContext {
|
|
23
22
|
* @type {import('../ipc/IPCClient')}
|
24
23
|
*/
|
25
24
|
this[_ipcClient] = null;
|
26
|
-
/**
|
27
|
-
* @private
|
28
|
-
* @type {undefined | boolean}
|
29
|
-
*
|
30
|
-
* TODO: explain what is short lifecycle and why we need it
|
31
|
-
*/
|
32
|
-
this[_shortLifecycle] = false;
|
33
25
|
}
|
34
26
|
|
35
27
|
//#region Internal members
|
package/src/utils/argparse.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
const path = require('path');
|
2
|
+
|
1
3
|
const _ = require('lodash');
|
2
4
|
const argv = require('minimist')(process.argv.slice(2));
|
3
5
|
|
@@ -81,9 +83,18 @@ function joinArgs(keyValues, options = DEFAULT_JOIN_ARGUMENTS_OPTIONS) {
|
|
81
83
|
return argArray.join(' ');
|
82
84
|
}
|
83
85
|
|
86
|
+
function getCurrentCommand() {
|
87
|
+
const cwd = process.cwd();
|
88
|
+
|
89
|
+
return process.argv.slice(1).map((value, index) => {
|
90
|
+
return index ? value : path.relative(cwd, value);
|
91
|
+
}).join(' ');
|
92
|
+
}
|
93
|
+
|
84
94
|
module.exports = {
|
85
95
|
getArgValue,
|
86
96
|
getEnvValue,
|
87
97
|
getFlag,
|
88
98
|
joinArgs,
|
99
|
+
getCurrentCommand,
|
89
100
|
};
|
@@ -1 +0,0 @@
|
|
1
|
-
0b09890dab4c0f9d2e18ce9810152b48
|
@@ -1 +0,0 @@
|
|
1
|
-
4fb3f1aa20e1d1a833a2ef036ca603165505cc54
|
@@ -1 +0,0 @@
|
|
1
|
-
6bfd20ec1ae900abd578d862751e5ac04ef373cbe27201e7dbb078779340eaa5
|
@@ -1 +0,0 @@
|
|
1
|
-
f969f49c3ed45ff55bc020e06ed2ce25ec442379d558f6c9a7a1f0345a472a4245cfaad8ceba876e6459920c8fb691eddc7906baf4231ef7838bc49c3822f2cd
|
@@ -1 +0,0 @@
|
|
1
|
-
d9897e95c4ecf505d3f7b2ae7e11eb47
|
@@ -1 +0,0 @@
|
|
1
|
-
fad4877aef09f6ff02c3fd424200df022e44f047
|
@@ -1 +0,0 @@
|
|
1
|
-
6d018ab8b1a477b086e9cb9daabb86b406a84b908acb5b51aa19e07cf178c4f7
|
@@ -1 +0,0 @@
|
|
1
|
-
fb025c2b71f43d76d274e2a9c62654f6b3497cdf8ddf4b92318a35508e3383c87a0ed0b9f5e461c7e1a6779962d3a012f23baa9a9f2116525f6c32d8c163882c
|
@@ -1 +0,0 @@
|
|
1
|
-
3bdd1b42fa0f182255a47fcdda8f544c
|
@@ -1 +0,0 @@
|
|
1
|
-
457ae10d202b196ea92bade4a33ce2dbc2f8bb3f
|
@@ -1 +0,0 @@
|
|
1
|
-
52342d1b0d1fae681b2ea1e6f9ac6f6278299ed70d7867fd60b95d63eb7a9ec3
|
@@ -1 +0,0 @@
|
|
1
|
-
5dfa73d84d647fd870a2e915d9943c9502c967abfd89a834ef7dee50a2a77d5a8b0be7b13407a34a6b97cbc10e9ed6f5e608fe7366d5a3041e462e3322d5b10d
|
@@ -1 +0,0 @@
|
|
1
|
-
a3e045f487ba8e722d220f63208ad9ac
|
@@ -1 +0,0 @@
|
|
1
|
-
779c98eabebaa2cebd52d12afa1981259ecdb05a
|
@@ -1 +0,0 @@
|
|
1
|
-
ba3edd4b7874e8e296a34bc55fa4aa1d49a40eb36ce442de000e62e9876e3b2d
|
@@ -1 +0,0 @@
|
|
1
|
-
05ee92a5fcff9f5b53bc52ba1d5e3915369d0b34df12f94690f8b87f30ec705d2ba00d52bc79293cbcfecfbdc6773167b544b4973d82fbb4d6ecaed4ee3ae2a5
|
@@ -1,25 +0,0 @@
|
|
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: '' });
|
@@ -1,12 +0,0 @@
|
|
1
|
-
const DEVICE_LAUNCH_ARGS_DEPRECATION = `\
|
2
|
-
--device-launch-args is a deprecated name of this option.
|
3
|
-
Please change your scripts to use --device-boot-args instead.`;
|
4
|
-
|
5
|
-
const DEVICE_LAUNCH_ARGS_GENERIC_DEPRECATION = `\
|
6
|
-
--device-launch-args / $DETOX_DEVICE_LAUNCH_ARGS is a deprecated name of this option.
|
7
|
-
Please change your scripts to use --device-boot-args / $DETOX_DEVICE_BOOT_ARGS instead.`;
|
8
|
-
|
9
|
-
module.exports = {
|
10
|
-
DEVICE_LAUNCH_ARGS_DEPRECATION,
|
11
|
-
DEVICE_LAUNCH_ARGS_GENERIC_DEPRECATION,
|
12
|
-
};
|