@brillout/test-e2e 0.5.30 → 0.5.32
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/bin.js +1 -1
- package/dist/editFile.js +3 -1
- package/dist/utils/runCommandLongRunning.js +14 -12
- 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
package/bin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import './dist/cli.js'
|
package/dist/editFile.js
CHANGED
|
@@ -5,6 +5,8 @@ import fs from 'fs';
|
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { assert } from './utils.js';
|
|
7
7
|
import { getCurrentTest } from './getCurrentTest.js';
|
|
8
|
+
import { createRequire } from 'module';
|
|
9
|
+
const require_ = createRequire(import.meta.url);
|
|
8
10
|
const filesContentOriginal = {};
|
|
9
11
|
function editFile(filePathRelative, replacer) {
|
|
10
12
|
const filePath = getFilePath(filePathRelative);
|
|
@@ -38,6 +40,6 @@ function editFileAssertReverted() {
|
|
|
38
40
|
function getFilePath(filePathRelative) {
|
|
39
41
|
const { testFile } = getCurrentTest();
|
|
40
42
|
const cwd = path.dirname(testFile);
|
|
41
|
-
const filePath =
|
|
43
|
+
const filePath = require_.resolve(filePathRelative, { paths: [cwd] });
|
|
42
44
|
return filePath;
|
|
43
45
|
}
|
|
@@ -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 {
|
|
@@ -228,13 +229,14 @@ function isSuccessCode(code) {
|
|
|
228
229
|
const spawn2: typeof spawn_ = (...args) => spawn_(...args)
|
|
229
230
|
const spawn3: typeof spawn_ = function(...args) { return spawn_(...args) }
|
|
230
231
|
//*/
|
|
231
|
-
function
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
232
|
+
function nodeWorkaround() {
|
|
233
|
+
if (isWindows()) {
|
|
234
|
+
// Workaround for Node.js regression:
|
|
235
|
+
// - https://github.com/nodejs/node/issues/52475
|
|
236
|
+
// - https://github.com/prebuild/prebuildify/issues/83#issuecomment-2056607495
|
|
237
|
+
return { shell: true };
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
return {};
|
|
241
|
+
}
|
|
240
242
|
}
|
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