@brillout/test-e2e 0.5.10 → 0.5.11
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 +5 -0
- package/dist/Logs.d.ts +1 -1
- package/dist/Logs.js +8 -2
- package/dist/page.js +2 -2
- package/dist/run.js +4 -1
- package/dist/runAll.js +1 -1
- package/dist/utils/cliConfig.d.ts +4 -2
- package/dist/utils/cliConfig.js +11 -4
- package/dist/utils/parseCli.d.ts +6 -0
- package/dist/utils/parseCli.js +27 -0
- package/package.json +1 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.isTolerateError = void 0;
|
|
4
7
|
const getConfig_1 = require("../getConfig");
|
|
8
|
+
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
5
9
|
function isTolerateError({ logSource, logText }) {
|
|
10
|
+
logText = (0, strip_ansi_1.default)(logText);
|
|
6
11
|
if (tolerateError({ logSource, logText })) {
|
|
7
12
|
return true;
|
|
8
13
|
}
|
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:
|
|
8
|
+
logEagerly: "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: 'all',
|
|
14
14
|
};
|
|
15
15
|
const utils_1 = require("./utils");
|
|
16
16
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
@@ -72,7 +72,13 @@ function add({ logSource, logText, loggedAfterExit = false, }) {
|
|
|
72
72
|
};
|
|
73
73
|
logEntries.push(logEntry);
|
|
74
74
|
if (exports.Logs.logEagerly) {
|
|
75
|
-
|
|
75
|
+
let shouldLog = false;
|
|
76
|
+
if (exports.Logs.logEagerly === 'all')
|
|
77
|
+
shouldLog = true;
|
|
78
|
+
if (exports.Logs.logEagerly === 'logs' && logSource !== 'Playwright')
|
|
79
|
+
shouldLog = true;
|
|
80
|
+
if (shouldLog)
|
|
81
|
+
printLog(logEntry);
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
function expectLog(logText, logFilter) {
|
package/dist/page.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.page = void 0;
|
|
4
|
-
const utils_1 = require("./utils");
|
|
5
4
|
const getCurrentTest_1 = require("./getCurrentTest");
|
|
6
5
|
const page = new Proxy({}, {
|
|
7
6
|
get(_, prop) {
|
|
8
7
|
const { page } = (0, getCurrentTest_1.getCurrentTest)();
|
|
9
|
-
|
|
8
|
+
if (!page)
|
|
9
|
+
throw new Error("`page` isn't available. Make sure to access `page` only inside test() calls. In particular, if test() is async, then make sure to await all asynchronous code executed by your async test().");
|
|
10
10
|
return page[prop];
|
|
11
11
|
},
|
|
12
12
|
});
|
package/dist/run.js
CHANGED
|
@@ -21,7 +21,10 @@ additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect
|
|
|
21
21
|
isFlaky,
|
|
22
22
|
});
|
|
23
23
|
if (inspect) {
|
|
24
|
-
Logs_1.Logs.logEagerly =
|
|
24
|
+
Logs_1.Logs.logEagerly = 'all';
|
|
25
|
+
}
|
|
26
|
+
else if (utils_1.cliConfig.verbose) {
|
|
27
|
+
Logs_1.Logs.logEagerly = 'logs';
|
|
25
28
|
}
|
|
26
29
|
const testInfo = (0, getCurrentTest_1.getCurrentTest)();
|
|
27
30
|
let runProcess = null;
|
package/dist/runAll.js
CHANGED
|
@@ -27,7 +27,7 @@ async function runAll(filter) {
|
|
|
27
27
|
(0, utils_1.assert)(hasFailedTestFile && hasFailLog);
|
|
28
28
|
(0, utils_1.assert)(failedTestFiles.length > 0);
|
|
29
29
|
throw new Error([
|
|
30
|
-
'Following test files failed, see
|
|
30
|
+
'Following test files failed, see logs above for more information.',
|
|
31
31
|
...failedTestFiles.map((testFile) => ` ${testFile}`),
|
|
32
32
|
].join('\n'));
|
|
33
33
|
}
|
package/dist/utils/cliConfig.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cliConfig = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const parseCli_1 = require("./parseCli");
|
|
5
|
+
(0, parseCli_1.prepare)();
|
|
6
|
+
const verbose = (0, parseCli_1.check)('--verbose');
|
|
7
|
+
const inspect = (0, parseCli_1.check)('--inspect');
|
|
8
|
+
const debugEsbuild = (0, parseCli_1.check)('--debug-esbuild');
|
|
9
|
+
(0, parseCli_1.validate)();
|
|
10
|
+
const cliConfig = {
|
|
11
|
+
verbose,
|
|
7
12
|
// To inspect a specific test: `$ touch examples/some-example/INSPECT`
|
|
8
|
-
inspect:
|
|
13
|
+
inspect: inspect || !!process.env.TEST_INSPECT,
|
|
14
|
+
debugEsbuild,
|
|
9
15
|
};
|
|
16
|
+
exports.cliConfig = cliConfig;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validate = exports.check = exports.prepare = void 0;
|
|
4
|
+
let optionList;
|
|
5
|
+
const optionsKnown = [];
|
|
6
|
+
function prepare() {
|
|
7
|
+
optionList = process.argv.filter((w) => w.startsWith('--'));
|
|
8
|
+
}
|
|
9
|
+
exports.prepare = prepare;
|
|
10
|
+
function check(option) {
|
|
11
|
+
optionsKnown.push(option);
|
|
12
|
+
const val = optionList.includes(option);
|
|
13
|
+
if (val)
|
|
14
|
+
optionList = optionList.filter((s) => s !== option);
|
|
15
|
+
return val;
|
|
16
|
+
}
|
|
17
|
+
exports.check = check;
|
|
18
|
+
function validate() {
|
|
19
|
+
if (optionList.length > 0) {
|
|
20
|
+
throw new Error([
|
|
21
|
+
// prettier-ignore
|
|
22
|
+
`unknown options: ${optionList.join(' ')}`,
|
|
23
|
+
`known options: ${optionsKnown.join(' ')}`,
|
|
24
|
+
].join('\n'));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.validate = validate;
|