@brillout/test-e2e 0.5.25 → 0.5.27
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/isTolerateError.js +35 -17
- package/dist/Logs.js +9 -9
- package/dist/getConfig.js +4 -1
- package/dist/testScreenshotFixture.js +1 -1
- package/dist/utils/cliOptions.js +2 -4
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ const getConfig_1 = require("../getConfig");
|
|
|
8
8
|
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
9
9
|
function isTolerateError({ logSource, logText }) {
|
|
10
10
|
logText = (0, strip_ansi_1.default)(logText);
|
|
11
|
-
if (
|
|
11
|
+
if (tolerateErrorBuiltIn({ logSource, logText })) {
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
14
|
const config = (0, getConfig_1.getConfig)();
|
|
@@ -18,20 +18,38 @@ function isTolerateError({ logSource, logText }) {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
exports.isTolerateError = isTolerateError;
|
|
21
|
-
function
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
function tolerateErrorBuiltIn({ logSource, logText }) {
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
logText: 'ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time',
|
|
25
|
+
logSource: 'stderr',
|
|
26
|
+
},
|
|
27
|
+
/* Ignore:
|
|
28
|
+
```
|
|
29
|
+
[16:00:26.335][/examples/i18n-v1][npm run dev][run()] Terminate server.
|
|
30
|
+
[16:00:26.342][/examples/i18n-v1][npm run dev][stderr] The service was stopped: write EPIPE
|
|
31
|
+
[16:00:26.342][/examples/i18n-v1][npm run dev][run()] Process termination. (Nominal, exit code: null.)
|
|
32
|
+
``` */
|
|
33
|
+
{
|
|
34
|
+
logText: 'The service was stopped: write EPIPE',
|
|
35
|
+
logSource: 'stderr',
|
|
36
|
+
},
|
|
37
|
+
/* Ignore Chrome logging warning when it cannot do its creepy tracking: https://stackoverflow.com/questions/69619035/error-with-permissions-policy-header-unrecognized-feature-interest-cohort
|
|
38
|
+
```
|
|
39
|
+
[15:57:20.273][/test/abort/test-dev-server.test.ts][npm run dev:server][Browser Warning] {
|
|
40
|
+
"type": "warning",
|
|
41
|
+
"text": "Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.",
|
|
42
|
+
"location": {
|
|
43
|
+
"url": "",
|
|
44
|
+
"lineNumber": 0,
|
|
45
|
+
"columnNumber": 0
|
|
46
|
+
},
|
|
47
|
+
"args": []
|
|
48
|
+
}
|
|
49
|
+
``` */
|
|
50
|
+
{
|
|
51
|
+
logText: 'Error with Permissions-Policy header: Origin trial controlled feature not enabled',
|
|
52
|
+
logSource: 'Browser Warning',
|
|
53
|
+
},
|
|
54
|
+
].some((l) => l.logSource === logSource && logText.includes(l.logText));
|
|
37
55
|
}
|
package/dist/Logs.js
CHANGED
|
@@ -82,21 +82,21 @@ function add({ logSource, logText, loggedAfterExit = false, }) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
function expectLog(logText, logFilter) {
|
|
85
|
-
|
|
85
|
+
let logsFound = logEntries.filter((logEntry) => {
|
|
86
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
92
|
+
if (logsFound.length === 0) {
|
|
93
|
+
throw new Error(`The following log was expected but it wasn't logged: "${logText}"`);
|
|
94
|
+
}
|
|
95
|
+
if (!logFilter)
|
|
96
|
+
return;
|
|
97
|
+
logsFound = logsFound.filter((logEntry) => logFilter(removeAnsi(logEntry)));
|
|
98
|
+
if (logsFound.length === 0) {
|
|
99
|
+
throw new Error(`The following log was logged as expected, but it didn't match the logFilter() you provided: "${logText}"`);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
exports.expectLog = expectLog;
|
package/dist/getConfig.js
CHANGED
|
@@ -16,7 +16,10 @@ function getConfig() {
|
|
|
16
16
|
exports.getConfig = getConfig;
|
|
17
17
|
async function loadConfig() {
|
|
18
18
|
const configFilePath = find();
|
|
19
|
-
|
|
19
|
+
if (!configFilePath) {
|
|
20
|
+
config = {};
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
20
23
|
const configFileExports = (await import((0, utils_1.fsWindowsBugWorkaround)(configFilePath)));
|
|
21
24
|
(0, utils_1.assertUsage)('default' in configFileExports, `${configFileName} should have a default export`);
|
|
22
25
|
assertConfig(configFileExports.default);
|
|
@@ -17,7 +17,7 @@ async function testScreenshotFixture({ screenshotFixturePath, doNotTestLocally,
|
|
|
17
17
|
const pngPaths = getPngPaths();
|
|
18
18
|
const pngFixturPath = screenshotFixturePath || pngPaths.pngFixturPath;
|
|
19
19
|
if (doNotTestLocally && !(0, utils_1.isCI)()) {
|
|
20
|
-
console.log(`\n${picocolors_1.default.blue(
|
|
20
|
+
console.log(`\n${picocolors_1.default.blue('INFO')} screenshot test skipped (because running test locally, i.e. not in a CI environment): ${pngFixturPath}`);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
if (!fs_1.default.existsSync(pngFixturPath)) {
|
package/dist/utils/cliOptions.js
CHANGED
|
@@ -7,10 +7,8 @@ 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
9
|
const bail = (0, parseCli_1.check)('--bail');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const exclude = check('--exclude')
|
|
13
|
-
*/
|
|
10
|
+
// Defined & used in ./findFiles.ts
|
|
11
|
+
const exclude = (0, parseCli_1.check)('--exclude');
|
|
14
12
|
(0, parseCli_1.validate)();
|
|
15
13
|
const cliOptions = {
|
|
16
14
|
verbose,
|