@brillout/test-e2e 0.5.31 → 0.5.33
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/dist/utils/runCommandLongRunning.js +14 -16
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -1
- package/package.json +1 -1
- package/dist/utils/hasProp.d.ts +0 -15
- package/dist/utils/hasProp.js +0 -50
- package/dist/utils/isArray.d.ts +0 -1
- package/dist/utils/isArray.js +0 -4
- package/dist/utils/isArrayOfStrings.d.ts +0 -2
- package/dist/utils/isArrayOfStrings.js +0 -5
- package/dist/utils/isObjectOfStrings.d.ts +0 -2
- package/dist/utils/isObjectOfStrings.js +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { runCommandLongRunning };
|
|
2
|
-
import { spawn
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
3
|
import stripAnsi from 'strip-ansi';
|
|
4
|
-
import { assert, runCommandShortLived, humanizeTime, isWindows, isLinux, isCallable
|
|
4
|
+
import { assert, runCommandShortLived, humanizeTime, isWindows, isLinux, isCallable } from '../utils.js';
|
|
5
5
|
function runCommandLongRunning({ cmd, cwd, killPort, isReadyLog, isReadyTimeout, onStdout, onStderr, onExit, onTerminationError, terminationTimeout, }) {
|
|
6
6
|
if (killPort)
|
|
7
7
|
killByPort(killPort);
|
|
@@ -43,7 +43,7 @@ function runCommandLongRunning({ cmd, cwd, killPort, isReadyLog, isReadyTimeout,
|
|
|
43
43
|
command = command + '.cmd';
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
const proc = spawn(command, args, { cwd, detached });
|
|
46
|
+
const proc = spawn(command, args, { cwd, detached, ...nodeWorkaround() });
|
|
47
47
|
let procExited = false;
|
|
48
48
|
proc.stdin.on('data', async (chunk) => {
|
|
49
49
|
const data = String(chunk);
|
|
@@ -191,6 +191,7 @@ function stopProcess({ proc, cwd, cmd, force, onTerminationError, }) {
|
|
|
191
191
|
// Ignoring stderr doesn't solve the problem that taskkill makes the process exit with code 1
|
|
192
192
|
'inherit', // stderr
|
|
193
193
|
],
|
|
194
|
+
...nodeWorkaround(),
|
|
194
195
|
});
|
|
195
196
|
}
|
|
196
197
|
else {
|
|
@@ -224,17 +225,14 @@ async function killByPort(port) {
|
|
|
224
225
|
function isSuccessCode(code) {
|
|
225
226
|
return code === 0 || code === null || (code === 1 && isWindows());
|
|
226
227
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
// Needed for spawn_() to return ChildProcessWithoutNullStreams instead of ChildProcess
|
|
238
|
-
assert(hasProp(options, 'stdio', 'undefined'));
|
|
239
|
-
return spawn_(command, args, options);
|
|
228
|
+
// Workaround for Node.js regression:
|
|
229
|
+
// - https://github.com/nodejs/node/issues/52475
|
|
230
|
+
// - https://github.com/prebuild/prebuildify/issues/83#issuecomment-2056607495
|
|
231
|
+
function nodeWorkaround() {
|
|
232
|
+
if (isWindows()) {
|
|
233
|
+
return { shell: true };
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
return {};
|
|
237
|
+
}
|
|
240
238
|
}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
package/package.json
CHANGED
package/dist/utils/hasProp.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { hasProp };
|
|
2
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'boolean'): obj is ObjectType & Record<PropName, boolean>;
|
|
3
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'number'): obj is ObjectType & Record<PropName, number>;
|
|
4
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'string'): obj is ObjectType & Record<PropName, string>;
|
|
5
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'object'): obj is ObjectType & Record<PropName, Record<string, unknown>>;
|
|
6
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'array'): obj is ObjectType & Record<PropName, unknown[]>;
|
|
7
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'string[]'): obj is ObjectType & Record<PropName, string[]>;
|
|
8
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'string{}'): obj is ObjectType & Record<PropName, Record<string, string>>;
|
|
9
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'function'): obj is ObjectType & Record<PropName, (...args: any[]) => unknown>;
|
|
10
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'undefined'): obj is ObjectType & Record<PropName, undefined>;
|
|
11
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'null'): obj is ObjectType & Record<PropName, null>;
|
|
12
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'true'): obj is ObjectType & Record<PropName, true>;
|
|
13
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName, type: 'false'): obj is ObjectType & Record<PropName, false>;
|
|
14
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey, Enum>(obj: ObjectType, prop: PropName, type: Enum[]): obj is ObjectType & Record<PropName, Enum>;
|
|
15
|
-
declare function hasProp<ObjectType, PropName extends PropertyKey>(obj: ObjectType, prop: PropName): obj is ObjectType & Record<PropName, unknown>;
|
package/dist/utils/hasProp.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export { hasProp };
|
|
2
|
-
// - https://2ality.com/2020/06/type-guards-assertion-functions-typescript.html
|
|
3
|
-
// - https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABDAzgFQJ4AcCmdgAUAbgIYA2IOAXIiWBgDSJTbWIDkARnHGTnewCUNUhRzIUibr35gA3AFgAUKEiwEEzLnzFylGnUbNWNdmBABbTjgBOQkXvGpE5q7cUrw0eElRa8hKL6tPRMLLimKFA2MGAA5vaIQU6SUTHxHqreGn6sOskGocYRHOAA1mBwAO5gickSiOWVNZle6r7oeYGOhUbhbGmxcYgAvKVgFdW1wlI8fHSIAN7KiMiExeIjW+OTNeyIgksrq4g2OFAgNkjRlMcAvsdnF1cb+EmOo9v9Hg9KyhAIKK0GhNKajRAAFgATMplCQUChbFACLltIQSEwzJZrHZBIJ-oCZAA6MhwOIEEj4v6eNQ+WgIpEEAFgAAmMHaIImzTAM3hiJsUEkzLZ7SOShOa0QTIQIp8hyelzAx1WUAAFjZqi4cFVEABRGwamwEdgAQQZArpADESDAyEJlHcgA
|
|
4
|
-
import { isCallable } from './isCallable.js';
|
|
5
|
-
import { isObject } from './isObject.js';
|
|
6
|
-
import { isArrayOfStrings } from './isArrayOfStrings.js';
|
|
7
|
-
import { isObjectOfStrings } from './isObjectOfStrings.js';
|
|
8
|
-
import { isArray } from './isArray.js';
|
|
9
|
-
function hasProp(obj, prop, type = 'unknown') {
|
|
10
|
-
if (!isObject(obj))
|
|
11
|
-
return false;
|
|
12
|
-
if (!(prop in obj)) {
|
|
13
|
-
return type === 'undefined';
|
|
14
|
-
}
|
|
15
|
-
if (type === 'unknown') {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
const propValue = obj[prop];
|
|
19
|
-
if (type === 'array') {
|
|
20
|
-
return isArray(propValue);
|
|
21
|
-
}
|
|
22
|
-
if (type === 'object') {
|
|
23
|
-
return isObject(propValue);
|
|
24
|
-
}
|
|
25
|
-
if (type === 'string[]') {
|
|
26
|
-
return isArrayOfStrings(propValue);
|
|
27
|
-
}
|
|
28
|
-
if (type === 'string{}') {
|
|
29
|
-
return isObjectOfStrings(propValue);
|
|
30
|
-
}
|
|
31
|
-
if (type === 'function') {
|
|
32
|
-
return isCallable(propValue);
|
|
33
|
-
}
|
|
34
|
-
if (isArray(type)) {
|
|
35
|
-
return typeof propValue === 'string' && type.includes(propValue);
|
|
36
|
-
}
|
|
37
|
-
if (type === 'null') {
|
|
38
|
-
return propValue === null;
|
|
39
|
-
}
|
|
40
|
-
if (type === 'undefined') {
|
|
41
|
-
return propValue === undefined;
|
|
42
|
-
}
|
|
43
|
-
if (type === 'true') {
|
|
44
|
-
return propValue === true;
|
|
45
|
-
}
|
|
46
|
-
if (type === 'false') {
|
|
47
|
-
return propValue === false;
|
|
48
|
-
}
|
|
49
|
-
return typeof propValue === type;
|
|
50
|
-
}
|
package/dist/utils/isArray.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isArray(value: unknown): value is unknown[];
|
package/dist/utils/isArray.js
DELETED