@wdio/local-runner 7.20.8 → 8.0.0-alpha.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/constants.js +3 -6
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10 -16
- package/build/repl.d.ts +2 -2
- package/build/repl.d.ts.map +1 -1
- package/build/repl.js +2 -8
- package/build/replQueue.d.ts +2 -2
- package/build/replQueue.d.ts.map +1 -1
- package/build/replQueue.js +3 -9
- package/build/run.js +14 -21
- package/build/stdStream.d.ts +1 -1
- package/build/stdStream.d.ts.map +1 -1
- package/build/stdStream.js +8 -11
- package/build/transformStream.d.ts +1 -1
- package/build/transformStream.d.ts.map +1 -1
- package/build/transformStream.js +7 -10
- package/build/utils.d.ts +1 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +1 -5
- package/build/worker.d.ts +3 -3
- package/build/worker.d.ts.map +1 -1
- package/build/worker.js +25 -27
- package/package.json +10 -8
package/build/constants.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.BUFFER_OPTIONS = exports.DEBUGGER_MESSAGES = exports.SHUTDOWN_TIMEOUT = void 0;
|
|
4
|
-
exports.SHUTDOWN_TIMEOUT = 5000;
|
|
5
|
-
exports.DEBUGGER_MESSAGES = [
|
|
1
|
+
export const SHUTDOWN_TIMEOUT = 5000;
|
|
2
|
+
export const DEBUGGER_MESSAGES = [
|
|
6
3
|
'Debugger listening on',
|
|
7
4
|
'Debugger attached',
|
|
8
5
|
'Waiting for the debugger'
|
|
9
6
|
];
|
|
10
|
-
|
|
7
|
+
export const BUFFER_OPTIONS = {
|
|
11
8
|
initialSize: (1000 * 1024),
|
|
12
9
|
incrementAmount: (100 * 1024) // grow by 10 kilobytes each time buffer overflows.
|
|
13
10
|
};
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WritableStreamBuffer } from 'stream-buffers';
|
|
2
2
|
import type { Options, Workers } from '@wdio/types';
|
|
3
|
-
import WorkerInstance from './worker';
|
|
3
|
+
import WorkerInstance from './worker.js';
|
|
4
4
|
interface RunArgs extends Workers.WorkerRunPayload {
|
|
5
5
|
command: string;
|
|
6
6
|
args: any;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,cAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,cAAc,MAAM,aAAa,CAAA;AAKxC,UAAU,OAAQ,SAAQ,OAAO,CAAC,gBAAgB;IAC9C,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,GAAG,CAAA;CACZ;AAED,MAAM,CAAC,OAAO,OAAO,WAAW;IAQxB,OAAO,CAAC,OAAO;IAPnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAK;IAE/C,MAAM,uBAA2C;IACjD,MAAM,uBAA2C;gBAG7C,UAAU,EAAE,OAAO,EACX,OAAO,EAAE,OAAO,CAAC,UAAU;IAGvC;;OAEG;IACH,UAAU;IAEV,cAAc;IAId,GAAG,CAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,aAAa,EAAE,EAAE,OAAO;IAiBjD;;;;;OAKG;IACH,QAAQ;CA2CX"}
|
package/build/index.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const stream_buffers_1 = require("stream-buffers");
|
|
8
|
-
const worker_1 = __importDefault(require("./worker"));
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
|
-
const log = (0, logger_1.default)('@wdio/local-runner');
|
|
11
|
-
class LocalRunner {
|
|
1
|
+
import logger from '@wdio/logger';
|
|
2
|
+
import { WritableStreamBuffer } from 'stream-buffers';
|
|
3
|
+
import WorkerInstance from './worker.js';
|
|
4
|
+
import { SHUTDOWN_TIMEOUT, BUFFER_OPTIONS } from './constants.js';
|
|
5
|
+
const log = logger('@wdio/local-runner');
|
|
6
|
+
export default class LocalRunner {
|
|
12
7
|
constructor(configFile, _config) {
|
|
13
8
|
this._config = _config;
|
|
14
9
|
this.workerPool = {};
|
|
15
|
-
this.stdout = new
|
|
16
|
-
this.stderr = new
|
|
10
|
+
this.stdout = new WritableStreamBuffer(BUFFER_OPTIONS);
|
|
11
|
+
this.stderr = new WritableStreamBuffer(BUFFER_OPTIONS);
|
|
17
12
|
}
|
|
18
13
|
/**
|
|
19
14
|
* nothing to initialise when running locally
|
|
@@ -31,7 +26,7 @@ class LocalRunner {
|
|
|
31
26
|
process.stdout.setMaxListeners(workerCnt + 2);
|
|
32
27
|
process.stderr.setMaxListeners(workerCnt + 2);
|
|
33
28
|
}
|
|
34
|
-
const worker = new
|
|
29
|
+
const worker = new WorkerInstance(this._config, workerOptions, this.stdout, this.stderr);
|
|
35
30
|
this.workerPool[workerOptions.cid] = worker;
|
|
36
31
|
worker.postMessage(command, args);
|
|
37
32
|
return worker;
|
|
@@ -67,7 +62,7 @@ class LocalRunner {
|
|
|
67
62
|
worker.postMessage('endSession', payload);
|
|
68
63
|
}
|
|
69
64
|
return new Promise((resolve) => {
|
|
70
|
-
const timeout = setTimeout(resolve,
|
|
65
|
+
const timeout = setTimeout(resolve, SHUTDOWN_TIMEOUT);
|
|
71
66
|
const interval = setInterval(() => {
|
|
72
67
|
const busyWorker = Object.entries(this.workerPool)
|
|
73
68
|
.filter(([, worker]) => worker.isBusy).length;
|
|
@@ -82,4 +77,3 @@ class LocalRunner {
|
|
|
82
77
|
});
|
|
83
78
|
}
|
|
84
79
|
}
|
|
85
|
-
exports.default = LocalRunner;
|
package/build/repl.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import vm from 'vm';
|
|
3
|
+
import vm from 'node:vm';
|
|
4
4
|
import WDIORepl, { ReplConfig, ReplCallback } from '@wdio/repl';
|
|
5
|
-
import type { ChildProcess } from 'child_process';
|
|
5
|
+
import type { ChildProcess } from 'node:child_process';
|
|
6
6
|
export default class WDIORunnerRepl extends WDIORepl {
|
|
7
7
|
childProcess: ChildProcess;
|
|
8
8
|
callback?: ReplCallback;
|
package/build/repl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../src/repl.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AAExB,OAAO,QAAQ,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,QAAQ;IAChD,YAAY,EAAE,YAAY,CAAA;IAC1B,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,gBAAgB,UAAQ;gBAEX,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU;IAK5D,OAAO,CAAC,SAAS;IAUjB,IAAI,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY;IAehF,QAAQ,CAAE,MAAM,EAAE,GAAG;IAUrB,KAAK,CAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO;CAQ9B"}
|
package/build/repl.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const repl_1 = __importDefault(require("@wdio/repl"));
|
|
7
|
-
class WDIORunnerRepl extends repl_1.default {
|
|
1
|
+
import WDIORepl from '@wdio/repl';
|
|
2
|
+
export default class WDIORunnerRepl extends WDIORepl {
|
|
8
3
|
constructor(childProcess, options) {
|
|
9
4
|
super(options);
|
|
10
5
|
this.commandIsRunning = false;
|
|
@@ -45,4 +40,3 @@ class WDIORunnerRepl extends repl_1.default {
|
|
|
45
40
|
return super.start(context);
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
|
-
exports.default = WDIORunnerRepl;
|
package/build/replQueue.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { ChildProcess } from 'child_process';
|
|
3
|
-
import WDIORepl from './repl';
|
|
2
|
+
import type { ChildProcess } from 'node:child_process';
|
|
3
|
+
import WDIORepl from './repl.js';
|
|
4
4
|
/**
|
|
5
5
|
* repl queue class
|
|
6
6
|
* allows to run debug commands in mutliple workers one after another
|
package/build/replQueue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replQueue.d.ts","sourceRoot":"","sources":["../src/replQueue.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"replQueue.d.ts","sourceRoot":"","sources":["../src/replQueue.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,QAAQ,MAAM,WAAW,CAAA;AAShC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,OAAO,CAAC,MAAM,CAAa;IAC3B,WAAW,CAAC,EAAE,QAAQ,CAAA;IAEtB,GAAG,CAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ;IAIjF,IAAI;IA2BJ,IAAI,SAAS,YAEZ;CACJ"}
|
package/build/replQueue.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const repl_1 = __importDefault(require("./repl"));
|
|
1
|
+
import WDIORepl from './repl.js';
|
|
7
2
|
/**
|
|
8
3
|
* repl queue class
|
|
9
4
|
* allows to run debug commands in mutliple workers one after another
|
|
10
5
|
*/
|
|
11
|
-
class ReplQueue {
|
|
6
|
+
export default class ReplQueue {
|
|
12
7
|
constructor() {
|
|
13
8
|
this._repls = [];
|
|
14
9
|
}
|
|
@@ -24,7 +19,7 @@ class ReplQueue {
|
|
|
24
19
|
return;
|
|
25
20
|
}
|
|
26
21
|
const { childProcess, options, onStart, onEnd } = nextRepl;
|
|
27
|
-
const runningRepl = this.runningRepl = new
|
|
22
|
+
const runningRepl = this.runningRepl = new WDIORepl(childProcess, options);
|
|
28
23
|
onStart();
|
|
29
24
|
runningRepl.start().then(() => {
|
|
30
25
|
const ev = {
|
|
@@ -41,4 +36,3 @@ class ReplQueue {
|
|
|
41
36
|
return Boolean(this.runningRepl);
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
exports.default = ReplQueue;
|
package/build/run.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const logger_1 = __importDefault(require("@wdio/logger"));
|
|
10
|
-
const constants_1 = require("./constants");
|
|
11
|
-
const log = (0, logger_1.default)('@wdio/local-runner');
|
|
12
|
-
exports.runner = new runner_1.default();
|
|
13
|
-
exports.runner.on('exit', process.exit.bind(process));
|
|
14
|
-
exports.runner.on('error', ({ name, message, stack }) => process.send({
|
|
1
|
+
import exitHook from 'async-exit-hook';
|
|
2
|
+
import Runner from '@wdio/runner';
|
|
3
|
+
import logger from '@wdio/logger';
|
|
4
|
+
import { SHUTDOWN_TIMEOUT } from './constants.js';
|
|
5
|
+
const log = logger('@wdio/local-runner');
|
|
6
|
+
export const runner = new Runner();
|
|
7
|
+
runner.on('exit', process.exit.bind(process));
|
|
8
|
+
runner.on('error', ({ name, message, stack }) => process.send({
|
|
15
9
|
origin: 'worker',
|
|
16
10
|
name: 'error',
|
|
17
11
|
content: { name, message, stack }
|
|
@@ -21,7 +15,7 @@ process.on('message', (m) => {
|
|
|
21
15
|
return;
|
|
22
16
|
}
|
|
23
17
|
log.info(`Run worker command: ${m.command}`);
|
|
24
|
-
|
|
18
|
+
runner[m.command](m).then((result) => process.send({
|
|
25
19
|
origin: 'worker',
|
|
26
20
|
name: 'finisedCommand',
|
|
27
21
|
content: {
|
|
@@ -36,13 +30,12 @@ process.on('message', (m) => {
|
|
|
36
30
|
/**
|
|
37
31
|
* catch sigint messages as they are handled by main process
|
|
38
32
|
*/
|
|
39
|
-
const exitHookFn = (callback) => {
|
|
33
|
+
export const exitHookFn = (callback) => {
|
|
40
34
|
if (!callback) {
|
|
41
35
|
return;
|
|
42
36
|
}
|
|
43
|
-
|
|
44
|
-
log.info(`Received SIGINT, giving process ${
|
|
45
|
-
setTimeout(callback,
|
|
37
|
+
runner.sigintWasCalled = true;
|
|
38
|
+
log.info(`Received SIGINT, giving process ${SHUTDOWN_TIMEOUT}ms to shutdown gracefully`);
|
|
39
|
+
setTimeout(callback, SHUTDOWN_TIMEOUT);
|
|
46
40
|
};
|
|
47
|
-
|
|
48
|
-
(0, async_exit_hook_1.default)(exports.exitHookFn);
|
|
41
|
+
exitHook(exitHookFn);
|
package/build/stdStream.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { Transform, TransformCallback } from 'stream';
|
|
3
|
+
import { Transform, TransformCallback } from 'node:stream';
|
|
4
4
|
export default class RunnerStream extends Transform {
|
|
5
5
|
constructor();
|
|
6
6
|
_transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
|
package/build/stdStream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdStream.d.ts","sourceRoot":"","sources":["../src/stdStream.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"stdStream.d.ts","sourceRoot":"","sources":["../src/stdStream.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG1D,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAS;;IAgB/C,UAAU,CAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAIpF,MAAM,CAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,SAAS,KAAK,IAAI,GAAG,IAAI;CAI/D"}
|
package/build/stdStream.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
|
-
class RunnerStream extends stream_1.Transform {
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
|
+
import { removeLastListener } from './utils.js';
|
|
3
|
+
export default class RunnerStream extends Transform {
|
|
6
4
|
constructor() {
|
|
7
5
|
super();
|
|
8
6
|
/**
|
|
9
7
|
* Remove events that are automatically created by Writable stream
|
|
10
8
|
*/
|
|
11
9
|
this.on('pipe', () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
removeLastListener(this, 'close');
|
|
11
|
+
removeLastListener(this, 'drain');
|
|
12
|
+
removeLastListener(this, 'error');
|
|
13
|
+
removeLastListener(this, 'finish');
|
|
14
|
+
removeLastListener(this, 'unpipe');
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
_transform(chunk, encoding, callback) {
|
|
@@ -24,4 +22,3 @@ class RunnerStream extends stream_1.Transform {
|
|
|
24
22
|
callback();
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
|
-
exports.default = RunnerStream;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformStream.d.ts","sourceRoot":"","sources":["../src/transformStream.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAgC,MAAM,
|
|
1
|
+
{"version":3,"file":"transformStream.d.ts","sourceRoot":"","sources":["../src/transformStream.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAgC,MAAM,aAAa,CAAA;AAGpE,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAK1F"}
|
package/build/transformStream.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
function runnerTransformStream(cid, inputStream) {
|
|
1
|
+
import split from 'split2';
|
|
2
|
+
import { Transform } from 'node:stream';
|
|
3
|
+
import { DEBUGGER_MESSAGES } from './constants.js';
|
|
4
|
+
export default function runnerTransformStream(cid, inputStream) {
|
|
7
5
|
return inputStream
|
|
8
6
|
.pipe(split(/\r?\n/, line => `${line}\n`))
|
|
9
|
-
.pipe(ignore(
|
|
7
|
+
.pipe(ignore(DEBUGGER_MESSAGES))
|
|
10
8
|
.pipe(map(line => `[${cid}] ${line}`));
|
|
11
9
|
}
|
|
12
|
-
exports.default = runnerTransformStream;
|
|
13
10
|
function ignore(patternsToIgnore) {
|
|
14
|
-
return new
|
|
11
|
+
return new Transform({
|
|
15
12
|
decodeStrings: false,
|
|
16
13
|
transform(chunk, encoding, next) {
|
|
17
14
|
if (patternsToIgnore.some(m => chunk.startsWith(m))) {
|
|
@@ -26,7 +23,7 @@ function ignore(patternsToIgnore) {
|
|
|
26
23
|
});
|
|
27
24
|
}
|
|
28
25
|
function map(mapper) {
|
|
29
|
-
return new
|
|
26
|
+
return new Transform({
|
|
30
27
|
decodeStrings: false,
|
|
31
28
|
transform(chunk, encoding, next) {
|
|
32
29
|
return next(null, mapper(chunk));
|
package/build/utils.d.ts
CHANGED
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,wBAAgB,kBAAkB,CAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAK9E"}
|
package/build/utils.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeLastListener = void 0;
|
|
4
|
-
function removeLastListener(target, eventName) {
|
|
1
|
+
export function removeLastListener(target, eventName) {
|
|
5
2
|
const listener = target.listeners(eventName).reverse()[0];
|
|
6
3
|
if (listener) {
|
|
7
4
|
target.removeListener(eventName, listener);
|
|
8
5
|
}
|
|
9
6
|
}
|
|
10
|
-
exports.removeLastListener = removeLastListener;
|
package/build/worker.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import child from 'child_process';
|
|
4
|
-
import { EventEmitter } from 'events';
|
|
3
|
+
import child from 'node:child_process';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
|
+
import type { ChildProcess } from 'node:child_process';
|
|
5
6
|
import type { WritableStreamBuffer } from 'stream-buffers';
|
|
6
|
-
import type { ChildProcess } from 'child_process';
|
|
7
7
|
import type { Capabilities, Options, Workers } from '@wdio/types';
|
|
8
8
|
/**
|
|
9
9
|
* WorkerInstance
|
package/build/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,MAAM,oBAAoB,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAiBjE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAAa,YAAW,OAAO,CAAC,MAAM;IAC9E,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,OAAO,CAAC,UAAU,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,YAAY,CAAC,gBAAgB,CAAA;IACnC,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAA;IAC3C,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,oBAAoB,CAAA;IAC5B,MAAM,EAAE,oBAAoB,CAAA;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACjD,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB,MAAM,UAAQ;IAEd;;;;;;;;;OASG;gBAEC,MAAM,EAAE,OAAO,CAAC,UAAU,EAC1B,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,CAAC,gBAAgB,EAC7E,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,oBAAoB;IAehC;;OAEG;IACH,YAAY;IA2CZ,OAAO,CAAC,cAAc;IA8CtB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,WAAW;IAiBnB;;;;OAIG;IACH,WAAW,CAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,iBAAiB,GAAG,IAAI;CAmBvE"}
|
package/build/worker.js
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const replQueue = new replQueue_1.default();
|
|
15
|
-
const stdOutStream = new stdStream_1.default();
|
|
16
|
-
const stdErrStream = new stdStream_1.default();
|
|
1
|
+
import url from 'node:url';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import child from 'node:child_process';
|
|
4
|
+
import { EventEmitter } from 'node:events';
|
|
5
|
+
import logger from '@wdio/logger';
|
|
6
|
+
import runnerTransformStream from './transformStream.js';
|
|
7
|
+
import ReplQueue from './replQueue.js';
|
|
8
|
+
import RunnerStream from './stdStream.js';
|
|
9
|
+
const log = logger('@wdio/local-runner');
|
|
10
|
+
const replQueue = new ReplQueue();
|
|
11
|
+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
12
|
+
const stdOutStream = new RunnerStream();
|
|
13
|
+
const stdErrStream = new RunnerStream();
|
|
17
14
|
stdOutStream.pipe(process.stdout);
|
|
18
15
|
stdErrStream.pipe(process.stderr);
|
|
19
16
|
/**
|
|
@@ -21,7 +18,7 @@ stdErrStream.pipe(process.stderr);
|
|
|
21
18
|
* responsible for spawning a sub process to run the framework in and handle its
|
|
22
19
|
* session lifetime.
|
|
23
20
|
*/
|
|
24
|
-
class WorkerInstance extends
|
|
21
|
+
export default class WorkerInstance extends EventEmitter {
|
|
25
22
|
/**
|
|
26
23
|
* assigns paramters to scope of instance
|
|
27
24
|
* @param {object} config parsed configuration object
|
|
@@ -53,14 +50,17 @@ class WorkerInstance extends events_1.EventEmitter {
|
|
|
53
50
|
const { cid, execArgv } = this;
|
|
54
51
|
const argv = process.argv.slice(2);
|
|
55
52
|
const runnerEnv = Object.assign({}, process.env, this.config.runnerEnv, {
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
WDIO_WORKER_ID: cid,
|
|
54
|
+
NODE_ENV: process.env.NODE_ENV || 'test'
|
|
58
55
|
});
|
|
59
56
|
if (this.config.outputDir) {
|
|
60
|
-
runnerEnv.WDIO_LOG_PATH =
|
|
57
|
+
runnerEnv.WDIO_LOG_PATH = path.join(this.config.outputDir, `wdio-${cid}.log`);
|
|
58
|
+
}
|
|
59
|
+
if (this.config.autoCompileOpts?.autoCompile) {
|
|
60
|
+
runnerEnv.NODE_OPTIONS = (runnerEnv.NODE_OPTIONS || '') + ' --loader ts-node/esm/transpile-only';
|
|
61
61
|
}
|
|
62
62
|
log.info(`Start worker ${cid} with arg: ${argv}`);
|
|
63
|
-
const childProcess = this.childProcess =
|
|
63
|
+
const childProcess = this.childProcess = child.fork(path.join(__dirname, 'run.js'), argv, {
|
|
64
64
|
cwd: process.cwd(),
|
|
65
65
|
env: runnerEnv,
|
|
66
66
|
execArgv,
|
|
@@ -70,18 +70,17 @@ class WorkerInstance extends events_1.EventEmitter {
|
|
|
70
70
|
childProcess.on('error', this._handleError.bind(this));
|
|
71
71
|
childProcess.on('exit', this._handleExit.bind(this));
|
|
72
72
|
/* istanbul ignore if */
|
|
73
|
-
if (!process.env.
|
|
73
|
+
if (!process.env.VITEST_WORKER_ID) {
|
|
74
74
|
if (childProcess.stdout !== null) {
|
|
75
|
-
(
|
|
75
|
+
runnerTransformStream(cid, childProcess.stdout).pipe(stdOutStream);
|
|
76
76
|
}
|
|
77
77
|
if (childProcess.stderr !== null) {
|
|
78
|
-
(
|
|
78
|
+
runnerTransformStream(cid, childProcess.stderr).pipe(stdErrStream);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
return childProcess;
|
|
82
82
|
}
|
|
83
83
|
_handleMessage(payload) {
|
|
84
|
-
var _a;
|
|
85
84
|
const { cid, childProcess } = this;
|
|
86
85
|
/**
|
|
87
86
|
* resolve pending commands
|
|
@@ -113,7 +112,7 @@ class WorkerInstance extends events_1.EventEmitter {
|
|
|
113
112
|
* handle debugger results
|
|
114
113
|
*/
|
|
115
114
|
if (replQueue.isRunning && payload.origin === 'debugger' && payload.name === 'result') {
|
|
116
|
-
|
|
115
|
+
replQueue.runningRepl?.onResult(payload.params);
|
|
117
116
|
}
|
|
118
117
|
this.emit('message', Object.assign(payload, { cid }));
|
|
119
118
|
}
|
|
@@ -156,4 +155,3 @@ class WorkerInstance extends events_1.EventEmitter {
|
|
|
156
155
|
this.isBusy = true;
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
|
-
exports.default = WorkerInstance;
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/local-runner",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.214+fada97c78",
|
|
4
4
|
"description": "A WebdriverIO runner to run tests locally",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-local-runner",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"main": "./build/index",
|
|
9
8
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
9
|
+
"node": "^16.13 || >=18"
|
|
11
10
|
},
|
|
12
11
|
"repository": {
|
|
13
12
|
"type": "git",
|
|
@@ -22,14 +21,18 @@
|
|
|
22
21
|
"bugs": {
|
|
23
22
|
"url": "https://github.com/webdriverio/webdriverio/issues"
|
|
24
23
|
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"exports": "./build/index.js",
|
|
26
|
+
"types": "./build/index.d.ts",
|
|
27
|
+
"typeScriptVersion": "3.8.3",
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@types/stream-buffers": "^3.0.
|
|
29
|
+
"@types/stream-buffers": "^3.0.4",
|
|
27
30
|
"@wdio/logger": "7.19.0",
|
|
28
31
|
"@wdio/repl": "7.20.7",
|
|
29
|
-
"@wdio/runner": "
|
|
32
|
+
"@wdio/runner": "8.0.0-alpha.214+fada97c78",
|
|
30
33
|
"@wdio/types": "7.20.7",
|
|
31
34
|
"async-exit-hook": "^2.0.1",
|
|
32
|
-
"split2": "^4.
|
|
35
|
+
"split2": "^4.1.0",
|
|
33
36
|
"stream-buffers": "^3.0.2"
|
|
34
37
|
},
|
|
35
38
|
"peerDependencies": {
|
|
@@ -38,6 +41,5 @@
|
|
|
38
41
|
"publishConfig": {
|
|
39
42
|
"access": "public"
|
|
40
43
|
},
|
|
41
|
-
"
|
|
42
|
-
"gitHead": "8ea0ee903b02157b9ee511c8750be2282b4f4519"
|
|
44
|
+
"gitHead": "fada97c788183c810b20025ca69680ae5a8ed45b"
|
|
43
45
|
}
|