@brillout/test-e2e 0.5.38 → 0.6.1
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 +11 -1
- package/dist/Logs.js +12 -2
- package/package.json +21 -18
package/dist/Logs.d.ts
CHANGED
|
@@ -25,4 +25,14 @@ declare function add({ logSource, logText, loggedAfterExit, }: {
|
|
|
25
25
|
logText: string;
|
|
26
26
|
loggedAfterExit?: boolean;
|
|
27
27
|
}): void;
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Expect a log to be printed.
|
|
30
|
+
*
|
|
31
|
+
* @param filter Only search in certain types of logs, e.g. only in browser- or server-side logs.
|
|
32
|
+
*
|
|
33
|
+
* @param allLogs Search in all logs, including the logs of previous tests as well as the logs of the setup/prepare scripts. Usually used in combination with the `filter` parameter.
|
|
34
|
+
*/
|
|
35
|
+
declare function expectLog(logText: string, { filter: logFilter, allLogs }?: {
|
|
36
|
+
filter?: (logEntry: LogEntry) => boolean;
|
|
37
|
+
allLogs?: boolean;
|
|
38
|
+
}): void;
|
package/dist/Logs.js
CHANGED
|
@@ -14,6 +14,7 @@ import { logSection } from './logSection.js';
|
|
|
14
14
|
import { isTolerateError } from './Logs/isTolerateError.js';
|
|
15
15
|
import stripAnsi from 'strip-ansi';
|
|
16
16
|
let logEntries = [];
|
|
17
|
+
const logEntriesAll = [];
|
|
17
18
|
function hasFailLogs(failOnWarning) {
|
|
18
19
|
const failLogs = getErrorLogs(failOnWarning);
|
|
19
20
|
return failLogs.length > 0;
|
|
@@ -66,6 +67,7 @@ function add({ logSource, logText, loggedAfterExit = false, }) {
|
|
|
66
67
|
loggedAfterExit,
|
|
67
68
|
};
|
|
68
69
|
logEntries.push(logEntry);
|
|
70
|
+
logEntriesAll.push(logEntry);
|
|
69
71
|
if (Logs.logEagerly) {
|
|
70
72
|
let shouldLog = false;
|
|
71
73
|
if (Logs.logEagerly === 'all')
|
|
@@ -76,8 +78,16 @@ function add({ logSource, logText, loggedAfterExit = false, }) {
|
|
|
76
78
|
printLog(logEntry);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Expect a log to be printed.
|
|
83
|
+
*
|
|
84
|
+
* @param filter Only search in certain types of logs, e.g. only in browser- or server-side logs.
|
|
85
|
+
*
|
|
86
|
+
* @param allLogs Search in all logs, including the logs of previous tests as well as the logs of the setup/prepare scripts. Usually used in combination with the `filter` parameter.
|
|
87
|
+
*/
|
|
88
|
+
function expectLog(logText, { filter: logFilter, allLogs } = {}) {
|
|
89
|
+
const logList = allLogs ? logEntriesAll : logEntries;
|
|
90
|
+
let logsFound = logList.filter((logEntry) => {
|
|
81
91
|
if (removeAnsi(logEntry).logText.includes(logText)) {
|
|
82
92
|
logEntry.isNotFailure = true;
|
|
83
93
|
return true;
|
package/package.json
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brillout/test-e2e",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"bin": "./bin.js",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"// === Dev ===": "",
|
|
9
|
-
"dev": "tsc --watch --project ./tsconfig.dev.json",
|
|
10
|
-
"// === Build ===": "",
|
|
11
|
-
"build": "rm -rf dist/ && tsc",
|
|
12
|
-
"// === Release ===": "",
|
|
13
|
-
"prepublishOnly": "pnpm run build",
|
|
14
|
-
"release": "npm version patch && npm publish && git push && git push --tags",
|
|
15
|
-
"========= Formatting": "",
|
|
16
|
-
"format": "pnpm run format:biome",
|
|
17
|
-
"format:prettier": "git ls-files | egrep '\\.(json|js|jsx|css|ts|tsx|vue|mjs|cjs)$' | grep --invert-match package.json | xargs pnpm exec prettier --write",
|
|
18
|
-
"format:biome": "biome format --write .",
|
|
19
|
-
"format:check": "biome format . || echo Fix formatting by running: $ pnpm run format",
|
|
20
|
-
"========= Reset": "",
|
|
21
|
-
"reset": "git clean -Xdf && pnpm install && pnpm run build"
|
|
22
|
-
},
|
|
23
7
|
"dependencies": {
|
|
24
8
|
"@brillout/part-regex": "^0.1.4",
|
|
25
9
|
"@brillout/picocolors": "^1.0.9",
|
|
@@ -35,6 +19,7 @@
|
|
|
35
19
|
},
|
|
36
20
|
"devDependencies": {
|
|
37
21
|
"@biomejs/biome": "^1.5.3",
|
|
22
|
+
"@brillout/release-me": "^0.4.3",
|
|
38
23
|
"@types/chai": "^4.3.3",
|
|
39
24
|
"@types/node": "^15.6.1",
|
|
40
25
|
"@types/node-fetch": "^2.5.12",
|
|
@@ -50,5 +35,23 @@
|
|
|
50
35
|
],
|
|
51
36
|
"publishConfig": {
|
|
52
37
|
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"// === Dev ===": "",
|
|
41
|
+
"dev": "tsc --watch --project ./tsconfig.dev.json",
|
|
42
|
+
"// === Build ===": "",
|
|
43
|
+
"build": "rm -rf dist/ && tsc",
|
|
44
|
+
"// === Release ===": "",
|
|
45
|
+
"release": "release-me patch",
|
|
46
|
+
"release:minor": "release-me minor",
|
|
47
|
+
"release:major": "release-me major",
|
|
48
|
+
"release:commit": "release-me commit",
|
|
49
|
+
"========= Formatting": "",
|
|
50
|
+
"format": "pnpm run format:biome",
|
|
51
|
+
"format:prettier": "git ls-files | egrep '\\.(json|js|jsx|css|ts|tsx|vue|mjs|cjs)$' | grep --invert-match package.json | xargs pnpm exec prettier --write",
|
|
52
|
+
"format:biome": "biome format --write .",
|
|
53
|
+
"format:check": "biome format . || echo Fix formatting by running: $ pnpm run format",
|
|
54
|
+
"========= Reset": "",
|
|
55
|
+
"reset": "git clean -Xdf && pnpm install && pnpm run build"
|
|
53
56
|
}
|
|
54
|
-
}
|
|
57
|
+
}
|