@brillout/test-e2e 0.5.12 → 0.5.14
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/Logs.d.ts +1 -1
- package/dist/Logs.js +10 -3
- package/dist/getCurrentTest.js +2 -1
- package/dist/utils/cliConfig.js +4 -0
- package/dist/utils/findFiles.js +10 -2
- package/package.json +1 -1
package/dist/Logs.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const Logs: {
|
|
|
5
5
|
logErrorsAndWarnings: typeof logErrorsAndWarnings;
|
|
6
6
|
clearLogs: typeof clearLogs;
|
|
7
7
|
hasFailLogs: typeof hasFailLogs;
|
|
8
|
-
logEagerly: "all" | "logs";
|
|
8
|
+
logEagerly: false | "all" | "logs";
|
|
9
9
|
};
|
|
10
10
|
export type { LogSource };
|
|
11
11
|
declare type LogSource = 'stdout' | 'stderr' | 'Browser Error' | 'Browser Warning' | 'Browser Log' | 'Playwright' | 'run()' | 'run() failure' | 'test()' | 'Connection Error';
|
package/dist/Logs.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.Logs = {
|
|
|
10
10
|
logErrorsAndWarnings,
|
|
11
11
|
clearLogs,
|
|
12
12
|
hasFailLogs,
|
|
13
|
-
logEagerly:
|
|
13
|
+
logEagerly: false,
|
|
14
14
|
};
|
|
15
15
|
const utils_1 = require("./utils");
|
|
16
16
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
@@ -83,13 +83,13 @@ function add({ logSource, logText, loggedAfterExit = false, }) {
|
|
|
83
83
|
}
|
|
84
84
|
function expectLog(logText, logFilter) {
|
|
85
85
|
const logsFound = logEntries.filter((logEntry) => {
|
|
86
|
-
if ((
|
|
86
|
+
if (removeAnsi(logEntry).logText.includes(logText)) {
|
|
87
87
|
logEntry.isNotFailure = true;
|
|
88
88
|
return true;
|
|
89
89
|
}
|
|
90
90
|
return false;
|
|
91
91
|
});
|
|
92
|
-
const logsFoundWithFilter = logsFound.filter((logEntry) => logFilter?.(logEntry));
|
|
92
|
+
const logsFoundWithFilter = logsFound.filter((logEntry) => logFilter?.(removeAnsi(logEntry)));
|
|
93
93
|
if (logsFoundWithFilter.length === 0) {
|
|
94
94
|
if (logsFound.length === 0) {
|
|
95
95
|
throw new Error(`The following log was expected but wasn't logged: "${logText}"`);
|
|
@@ -100,6 +100,13 @@ function expectLog(logText, logFilter) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
exports.expectLog = expectLog;
|
|
103
|
+
function removeAnsi(logEntry) {
|
|
104
|
+
const logEntryWithoutAnsi = {
|
|
105
|
+
...logEntry,
|
|
106
|
+
logText: (0, strip_ansi_1.default)(logEntry.logText),
|
|
107
|
+
};
|
|
108
|
+
return logEntryWithoutAnsi;
|
|
109
|
+
}
|
|
103
110
|
function getTimestamp() {
|
|
104
111
|
const now = new Date();
|
|
105
112
|
const time = now.toTimeString().split(' ')[0];
|
package/dist/getCurrentTest.js
CHANGED
|
@@ -9,7 +9,8 @@ const path_1 = __importDefault(require("path"));
|
|
|
9
9
|
const TIMEOUTS_1 = require("./TIMEOUTS");
|
|
10
10
|
let testInfo = null;
|
|
11
11
|
function getCurrentTest() {
|
|
12
|
-
|
|
12
|
+
if (!testInfo)
|
|
13
|
+
throw new Error('testInfo missing');
|
|
13
14
|
return testInfo;
|
|
14
15
|
}
|
|
15
16
|
exports.getCurrentTest = getCurrentTest;
|
package/dist/utils/cliConfig.js
CHANGED
|
@@ -6,6 +6,10 @@ const parseCli_1 = require("./parseCli");
|
|
|
6
6
|
const verbose = (0, parseCli_1.check)('--verbose');
|
|
7
7
|
const inspect = (0, parseCli_1.check)('--inspect');
|
|
8
8
|
const debugEsbuild = (0, parseCli_1.check)('--debug-esbuild');
|
|
9
|
+
/* Defined in ./findFiles.ts
|
|
10
|
+
* I don't think we use the --exclude option anymore? Can we remove it?
|
|
11
|
+
const exclude = check('--exclude')
|
|
12
|
+
*/
|
|
9
13
|
(0, parseCli_1.validate)();
|
|
10
14
|
const cliConfig = {
|
|
11
15
|
verbose,
|
package/dist/utils/findFiles.js
CHANGED
|
@@ -35,15 +35,23 @@ function applyFilter(filePathRelative, findFilter) {
|
|
|
35
35
|
}
|
|
36
36
|
const { terms, exclude } = findFilter;
|
|
37
37
|
for (const term of terms) {
|
|
38
|
-
if (!filePathRelative
|
|
38
|
+
if (!matches(filePathRelative, term) && !exclude) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
-
if (filePathRelative
|
|
41
|
+
if (matches(filePathRelative, term) && exclude) {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return true;
|
|
46
46
|
}
|
|
47
|
+
function matches(str, chunk) {
|
|
48
|
+
str = normalize(str);
|
|
49
|
+
chunk = normalize(chunk);
|
|
50
|
+
return str.includes(chunk);
|
|
51
|
+
}
|
|
52
|
+
function normalize(p) {
|
|
53
|
+
return path_1.default.normalize(p);
|
|
54
|
+
}
|
|
47
55
|
function findFilesParseCliArgs() {
|
|
48
56
|
const terms = [];
|
|
49
57
|
let exclude = false;
|