@brillout/test-e2e 0.4.7 → 0.4.8
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/setup.js
CHANGED
|
@@ -314,7 +314,7 @@ function execRunScript({ onStdout, onFailure, onExit, }) {
|
|
|
314
314
|
});
|
|
315
315
|
proc.stdout.on('data', (chunk) => {
|
|
316
316
|
const data = String(chunk);
|
|
317
|
-
assertNotExited(data)
|
|
317
|
+
// assertNotExited(data)
|
|
318
318
|
(0, utils_2.assert)(getRunInfo().cmd === cmd);
|
|
319
319
|
Logs_1.Logs.add({
|
|
320
320
|
logSource: 'stdout',
|
|
@@ -324,7 +324,7 @@ function execRunScript({ onStdout, onFailure, onExit, }) {
|
|
|
324
324
|
});
|
|
325
325
|
proc.stderr.on('data', async (chunk) => {
|
|
326
326
|
const data = String(chunk);
|
|
327
|
-
assertNotExited(data)
|
|
327
|
+
// assertNotExited(data)
|
|
328
328
|
(0, utils_2.assert)(getRunInfo().cmd === cmd);
|
|
329
329
|
Logs_1.Logs.add({
|
|
330
330
|
logSource: 'stderr',
|
|
@@ -359,14 +359,15 @@ function execRunScript({ onStdout, onFailure, onExit, }) {
|
|
|
359
359
|
exitPromiseResolve();
|
|
360
360
|
});
|
|
361
361
|
return { terminate, processHasExited };
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
362
|
+
/* Node.js seems to occasionally emit 'data' events after having the emitted 'exit' event, for example:
|
|
363
|
+
* - `{"data":"[0] npm run serve:cdn exited with code SIGTERM\n","dataLength":48}`.
|
|
364
|
+
function assertNotExited(data: string) {
|
|
365
|
+
if (!procExited) return
|
|
366
|
+
// Sometimes, a single white space is emitted after 'exit' has been emitted.
|
|
367
|
+
if (data.trim().length === 0) return
|
|
368
|
+
assert(false, { data, dataLength: data.length })
|
|
369
369
|
}
|
|
370
|
+
*/
|
|
370
371
|
function processHasExited() {
|
|
371
372
|
return procExited;
|
|
372
373
|
}
|
package/dist/utils/assert.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.projectErrorPrefix = exports.getProjectError = exports.assertInfo = exports.assertWarning = exports.assertUsage = exports.assert = void 0;
|
|
4
4
|
const runTests_1 = require("../runTests");
|
|
5
|
-
const createErrorWithCleanStackTrace_1 = require("./createErrorWithCleanStackTrace");
|
|
6
5
|
const projectInfo_1 = require("./projectInfo");
|
|
7
6
|
const Logs_1 = require("../Logs");
|
|
8
7
|
const getCurrentTest_1 = require("../getCurrentTest");
|
|
@@ -26,13 +25,13 @@ function assert(condition, debugInfo) {
|
|
|
26
25
|
const debugInfoSerialized = typeof debugInfo === 'string' ? debugInfo : '`' + JSON.stringify(debugInfo) + '`';
|
|
27
26
|
return `Debug info (this is for the ${projectInfo_1.projectInfo.projectName} maintainers; you can ignore this): ${debugInfoSerialized}.`;
|
|
28
27
|
})();
|
|
29
|
-
const internalError =
|
|
28
|
+
const internalError = new Error([
|
|
30
29
|
`${internalErrorPrefix} You stumbled upon a bug in ${projectInfo_1.projectInfo.projectName}'s source code.`,
|
|
31
30
|
`Reach out at ${projectInfo_1.projectInfo.githubRepository}/issues/new and include this error stack (the error stack is usually enough to fix the problem).`,
|
|
32
31
|
'A maintainer will fix the bug (usually under 24 hours).',
|
|
33
32
|
`Do not hesitate to reach out as it makes ${projectInfo_1.projectInfo.projectName} more robust.`,
|
|
34
33
|
debugStr,
|
|
35
|
-
].join(' ')
|
|
34
|
+
].join(' '));
|
|
36
35
|
(0, runTests_1.logFailure)('a bug occurred in @brillout/test-e2e');
|
|
37
36
|
(0, logError_1.logError)(internalError, 'BUG');
|
|
38
37
|
logDebugInfo();
|
|
@@ -46,13 +45,12 @@ function assertUsage(condition, errorMessage) {
|
|
|
46
45
|
return;
|
|
47
46
|
}
|
|
48
47
|
const whiteSpace = errorMessage.startsWith('[') ? '' : ' ';
|
|
49
|
-
|
|
50
|
-
throw usageError;
|
|
48
|
+
throw new Error(`${usageErrorPrefix}${whiteSpace}${errorMessage}`);
|
|
51
49
|
}
|
|
52
50
|
exports.assertUsage = assertUsage;
|
|
53
51
|
function getProjectError(errorMessage) {
|
|
54
|
-
const
|
|
55
|
-
return
|
|
52
|
+
const projectError = new Error(`${errorPrefix} ${errorMessage}`);
|
|
53
|
+
return projectError;
|
|
56
54
|
}
|
|
57
55
|
exports.getProjectError = getProjectError;
|
|
58
56
|
let loggedWarnings = new Set();
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createErrorWithCleanStackTrace = void 0;
|
|
4
|
-
function createErrorWithCleanStackTrace(errorMessage, numberOfStackTraceLinesToRemove) {
|
|
5
|
-
let err;
|
|
6
|
-
{
|
|
7
|
-
var stackTraceLimit__original = Error.stackTraceLimit;
|
|
8
|
-
Error.stackTraceLimit = Infinity;
|
|
9
|
-
err = new Error(errorMessage);
|
|
10
|
-
Error.stackTraceLimit = stackTraceLimit__original;
|
|
11
|
-
}
|
|
12
|
-
err.stack = clean(err.stack, numberOfStackTraceLinesToRemove);
|
|
13
|
-
return err;
|
|
14
|
-
}
|
|
15
|
-
exports.createErrorWithCleanStackTrace = createErrorWithCleanStackTrace;
|
|
16
|
-
function clean(errStack, numberOfStackTraceLinesToRemove) {
|
|
17
|
-
if (!errStack) {
|
|
18
|
-
return errStack;
|
|
19
|
-
}
|
|
20
|
-
const stackLines = splitByLine(errStack);
|
|
21
|
-
let linesRemoved = 0;
|
|
22
|
-
const stackLine__cleaned = stackLines
|
|
23
|
-
.filter((line) => {
|
|
24
|
-
// Remove internal stack traces
|
|
25
|
-
if (line.includes(' (internal/') || line.includes(' (node:internal')) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
if (linesRemoved < numberOfStackTraceLinesToRemove && isStackTraceLine(line)) {
|
|
29
|
-
linesRemoved++;
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
return true;
|
|
33
|
-
})
|
|
34
|
-
.join('\n');
|
|
35
|
-
return stackLine__cleaned;
|
|
36
|
-
}
|
|
37
|
-
function isStackTraceLine(line) {
|
|
38
|
-
return line.startsWith(' at ');
|
|
39
|
-
}
|
|
40
|
-
function splitByLine(str) {
|
|
41
|
-
// https://stackoverflow.com/questions/21895233/how-in-node-to-split-string-by-newline-n
|
|
42
|
-
return str.split(/\r?\n/);
|
|
43
|
-
}
|