@wdio/repl 7.20.3 → 8.0.0-alpha.219
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 +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +11 -22
- package/package.json +5 -7
package/build/constants.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CONFIG = exports.INTRO_MESSAGE = exports.STATIC_RETURNS = void 0;
|
|
4
|
-
exports.STATIC_RETURNS = {
|
|
1
|
+
export const STATIC_RETURNS = {
|
|
5
2
|
driver: '[WebdriverIO REPL client]',
|
|
6
3
|
browser: '[WebdriverIO REPL client]',
|
|
7
4
|
$: '[Function: findElement]',
|
|
8
5
|
$$: '[Function: findElements]'
|
|
9
6
|
};
|
|
10
|
-
|
|
7
|
+
export const INTRO_MESSAGE = `
|
|
11
8
|
The execution has stopped!
|
|
12
9
|
You can now go into the browser or use the command line as REPL
|
|
13
10
|
(To exit, press ^C again or type .exit)
|
|
14
11
|
`;
|
|
15
|
-
|
|
12
|
+
export const DEFAULT_CONFIG = {
|
|
16
13
|
commandTimeout: 5000,
|
|
17
14
|
prompt: '\u203A ',
|
|
18
15
|
useGlobal: true,
|
package/build/index.d.ts
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
*/
|
|
31
31
|
/// <reference types="node" />
|
|
32
32
|
/// <reference types="node" />
|
|
33
|
-
import vm from 'vm';
|
|
34
|
-
import repl from 'repl';
|
|
33
|
+
import vm from 'node:vm';
|
|
34
|
+
import repl from 'node:repl';
|
|
35
35
|
export interface ReplConfig {
|
|
36
36
|
commandTimeout: number;
|
|
37
37
|
eval: repl.REPLEval;
|
|
@@ -46,7 +46,7 @@ export default class WDIORepl {
|
|
|
46
46
|
private _isCommandRunning;
|
|
47
47
|
private _replServer;
|
|
48
48
|
constructor(config?: ReplConfig);
|
|
49
|
-
eval(cmd: string, context: vm.Context, filename: string | undefined, callback: ReplCallback): void
|
|
49
|
+
eval(cmd: string, context: vm.Context, filename: string | undefined, callback: ReplCallback): void;
|
|
50
50
|
private _runCmd;
|
|
51
51
|
private _handleResult;
|
|
52
52
|
start(context?: vm.Context): Promise<unknown>;
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAI5B,MAAM,WAAW,UAAU;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;CACpB;AAED,oBAAY,YAAY,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;AAEnE,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,MAAM,CAAC,YAAY,SAAgB;IACnC,OAAO,CAAC,OAAO,CAAY;IAC3B,OAAO,CAAC,iBAAiB,CAAQ;IACjC,OAAO,CAAC,WAAW,CAA6B;gBAEpC,MAAM,CAAC,EAAE,UAAU;IAQ/B,IAAI,CAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,YAAY;IAe5F,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,aAAa;IA2CrB,KAAK,CAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO;CAkB9B"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
*
|
|
4
3
|
* This command helps you to debug your integration tests. It stops the running browser and gives
|
|
@@ -29,37 +28,28 @@
|
|
|
29
28
|
* @type utility
|
|
30
29
|
*
|
|
31
30
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const vm_1 = __importDefault(require("vm"));
|
|
37
|
-
const repl_1 = __importDefault(require("repl"));
|
|
38
|
-
const utils_1 = require("@wdio/utils");
|
|
39
|
-
const constants_1 = require("./constants");
|
|
40
|
-
class WDIORepl {
|
|
31
|
+
import vm from 'node:vm';
|
|
32
|
+
import repl from 'node:repl';
|
|
33
|
+
import { STATIC_RETURNS, INTRO_MESSAGE, DEFAULT_CONFIG } from './constants.js';
|
|
34
|
+
export default class WDIORepl {
|
|
41
35
|
constructor(config) {
|
|
42
36
|
this._isCommandRunning = false;
|
|
43
|
-
this._config = Object.assign(
|
|
37
|
+
this._config = Object.assign(DEFAULT_CONFIG, { eval: this.eval.bind(this) }, config);
|
|
44
38
|
}
|
|
45
39
|
eval(cmd, context, filename, callback) {
|
|
46
40
|
if (this._isCommandRunning) {
|
|
47
41
|
return;
|
|
48
42
|
}
|
|
49
|
-
if (cmd &&
|
|
50
|
-
return callback(null,
|
|
43
|
+
if (cmd && STATIC_RETURNS[cmd.trim()]) {
|
|
44
|
+
return callback(null, STATIC_RETURNS[cmd.trim()]);
|
|
51
45
|
}
|
|
52
|
-
|
|
46
|
+
vm.createContext(context);
|
|
53
47
|
this._isCommandRunning = true;
|
|
54
|
-
/* istanbul ignore if */
|
|
55
|
-
if (utils_1.hasWdioSyncSupport) {
|
|
56
|
-
return (0, utils_1.runFnInFiberContext)(() => this._runCmd(cmd, context, callback))();
|
|
57
|
-
}
|
|
58
48
|
return this._runCmd(cmd, context, callback);
|
|
59
49
|
}
|
|
60
50
|
_runCmd(cmd, context, callback) {
|
|
61
51
|
try {
|
|
62
|
-
const result =
|
|
52
|
+
const result = vm.runInContext(cmd, context);
|
|
63
53
|
return this._handleResult(result, callback);
|
|
64
54
|
}
|
|
65
55
|
catch (e) {
|
|
@@ -113,11 +103,10 @@ class WDIORepl {
|
|
|
113
103
|
return evalFn.call(this, cmd, context, filename, callback);
|
|
114
104
|
};
|
|
115
105
|
}
|
|
116
|
-
this._replServer =
|
|
106
|
+
this._replServer = repl.start(this._config);
|
|
117
107
|
return new Promise((resolve) => {
|
|
118
108
|
return this._replServer.on('exit', resolve);
|
|
119
109
|
});
|
|
120
110
|
}
|
|
121
111
|
}
|
|
122
|
-
|
|
123
|
-
WDIORepl.introMessage = constants_1.INTRO_MESSAGE;
|
|
112
|
+
WDIORepl.introMessage = INTRO_MESSAGE;
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/repl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.219+4aab2cef1",
|
|
4
4
|
"description": "A WDIO helper utility to provide a repl interface for WebdriverIO",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-repl",
|
|
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,13 +21,12 @@
|
|
|
22
21
|
"bugs": {
|
|
23
22
|
"url": "https://github.com/webdriverio/webdriverio/issues"
|
|
24
23
|
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"exports": "./build/index.js",
|
|
25
26
|
"types": "./build/index.d.ts",
|
|
26
27
|
"typeScriptVersion": "3.8.3",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"@wdio/utils": "7.20.3"
|
|
29
|
-
},
|
|
30
28
|
"publishConfig": {
|
|
31
29
|
"access": "public"
|
|
32
30
|
},
|
|
33
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "4aab2cef1b8b195ac8cc611f28b1fd54e4ba3443"
|
|
34
32
|
}
|