@brillout/test-e2e 0.5.18 → 0.5.20
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/buildTs.js
CHANGED
package/dist/run.js
CHANGED
|
@@ -10,7 +10,7 @@ const page_1 = require("./page");
|
|
|
10
10
|
const TIMEOUTS_1 = require("./TIMEOUTS");
|
|
11
11
|
function run(cmd, {
|
|
12
12
|
//baseUrl = '',
|
|
13
|
-
additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect = utils_1.
|
|
13
|
+
additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect = utils_1.cliOptions.inspect, cwd, doNotFailOnWarning, serverUrl, isFlaky, } = {}) {
|
|
14
14
|
(0, utils_2.assert)(cwd === undefined);
|
|
15
15
|
additionalTimeout += serverIsReadyDelay;
|
|
16
16
|
(0, getCurrentTest_1.setRunInfo)({
|
|
@@ -23,7 +23,7 @@ additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect
|
|
|
23
23
|
if (inspect) {
|
|
24
24
|
Logs_1.Logs.logEagerly = 'all';
|
|
25
25
|
}
|
|
26
|
-
else if (utils_1.
|
|
26
|
+
else if (utils_1.cliOptions.verbose) {
|
|
27
27
|
Logs_1.Logs.logEagerly = 'logs';
|
|
28
28
|
}
|
|
29
29
|
const testInfo = (0, getCurrentTest_1.getCurrentTest)();
|
package/dist/runAll.js
CHANGED
|
@@ -5,7 +5,6 @@ const getCurrentTest_1 = require("./getCurrentTest");
|
|
|
5
5
|
const Logs_1 = require("./Logs");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
const utils_2 = require("./utils");
|
|
8
|
-
const parallel_ci_1 = require("./parallel-ci");
|
|
9
8
|
const getCurrentTest_2 = require("./getCurrentTest");
|
|
10
9
|
const getBrowser_1 = require("./getBrowser");
|
|
11
10
|
const buildTs_1 = require("./buildTs");
|
|
@@ -36,15 +35,22 @@ exports.runAll = runAll;
|
|
|
36
35
|
async function runTestFiles(testFiles, browser) {
|
|
37
36
|
// First attempt
|
|
38
37
|
let failedTestFiles = [];
|
|
38
|
+
let doNotRetry = false;
|
|
39
39
|
for (const testFile of testFiles) {
|
|
40
|
-
const success = await buildAndTest(testFile, browser, false);
|
|
40
|
+
const { success, isFlaky } = await buildAndTest(testFile, browser, false);
|
|
41
41
|
if (!success) {
|
|
42
42
|
failedTestFiles.push(testFile);
|
|
43
|
-
if (
|
|
43
|
+
if (!isFlaky) {
|
|
44
|
+
doNotRetry = true;
|
|
45
|
+
}
|
|
46
|
+
if (utils_1.cliOptions.bail) {
|
|
44
47
|
return failedTestFiles;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
}
|
|
51
|
+
if (doNotRetry) {
|
|
52
|
+
return failedTestFiles;
|
|
53
|
+
}
|
|
48
54
|
if (!(0, utils_1.isCI)()) {
|
|
49
55
|
return failedTestFiles;
|
|
50
56
|
}
|
|
@@ -53,7 +59,7 @@ async function runTestFiles(testFiles, browser) {
|
|
|
53
59
|
for (let i = 0; i <= 1; i++) {
|
|
54
60
|
console.log((i === 0 ? 'SECOND' : 'THIRD') + '_ATTEMPT');
|
|
55
61
|
for (const testFile of failedTestFiles) {
|
|
56
|
-
const success = await buildAndTest(testFile, browser,
|
|
62
|
+
const { success } = await buildAndTest(testFile, browser, i === 1);
|
|
57
63
|
if (success) {
|
|
58
64
|
failedTestFiles = failedTestFiles.filter((t) => t !== testFile);
|
|
59
65
|
}
|
|
@@ -62,7 +68,7 @@ async function runTestFiles(testFiles, browser) {
|
|
|
62
68
|
return failedTestFiles;
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
|
-
async function buildAndTest(testFile, browser,
|
|
71
|
+
async function buildAndTest(testFile, browser, isThirdAttempt) {
|
|
66
72
|
(0, utils_1.assert)(testFile.endsWith('.ts'));
|
|
67
73
|
const testFileJs = testFile.replace('.ts', '.mjs');
|
|
68
74
|
(0, utils_1.assert)(testFileJs.endsWith('.mjs'));
|
|
@@ -83,42 +89,45 @@ async function buildAndTest(testFile, browser, isSecondAttempt) {
|
|
|
83
89
|
if (execErr) {
|
|
84
90
|
(0, logTestStatus_1.logFail)(`an error was thrown while executing the file ${testFile}`, true);
|
|
85
91
|
(0, logError_1.logError)(execErr);
|
|
86
|
-
return
|
|
92
|
+
return {
|
|
93
|
+
success: false,
|
|
94
|
+
isFlaky: false,
|
|
95
|
+
};
|
|
87
96
|
}
|
|
88
97
|
// When user calls skip()
|
|
89
98
|
const testInfo = (0, getCurrentTest_1.getCurrentTest)();
|
|
90
99
|
if (testInfo.skipped) {
|
|
91
100
|
assertSkipUsage(testInfo);
|
|
92
101
|
(0, logTestStatus_1.logWarn)(testInfo.skipped.reason);
|
|
93
|
-
return
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
isFlaky: false,
|
|
105
|
+
};
|
|
94
106
|
}
|
|
95
107
|
else {
|
|
96
108
|
// Set when user calls run() or runCommandThatTerminates()
|
|
97
109
|
(0, utils_1.assert)(testInfo.runInfo);
|
|
98
110
|
}
|
|
111
|
+
const { isFlaky } = testInfo.runInfo;
|
|
99
112
|
// When user calls run runCommandThatTerminates()
|
|
100
113
|
if (testInfo.runInfo.isRunCommandThatTerminates) {
|
|
101
114
|
(0, utils_1.assertUsage)(!testInfo.tests, "Can't call test() when calling runCommandThatTerminates()");
|
|
102
115
|
(0, utils_1.assertUsage)(!testInfo.startServer, "Can't call run() when calling runCommandThatTerminates()");
|
|
103
116
|
(0, logTestStatus_1.logPass)();
|
|
104
|
-
return
|
|
117
|
+
return {
|
|
118
|
+
success: true,
|
|
119
|
+
isFlaky,
|
|
120
|
+
};
|
|
105
121
|
}
|
|
106
|
-
const success = await runServerAndTests(browser,
|
|
122
|
+
const success = await runServerAndTests(browser, isThirdAttempt, isFlaky);
|
|
107
123
|
(0, getCurrentTest_2.setCurrentTest)(null);
|
|
108
|
-
return success;
|
|
124
|
+
return { success, isFlaky };
|
|
109
125
|
}
|
|
110
|
-
async function runServerAndTests(browser,
|
|
126
|
+
async function runServerAndTests(browser, isThirdAttempt, isFlaky) {
|
|
111
127
|
const testInfo = (0, getCurrentTest_1.getCurrentTest)();
|
|
112
|
-
// Set when user calls run()
|
|
113
|
-
(0, utils_1.assert)(testInfo.runInfo);
|
|
114
128
|
(0, utils_1.assert)(testInfo.startServer);
|
|
115
129
|
(0, utils_1.assert)(testInfo.terminateServer);
|
|
116
|
-
const isFinalAttempt =
|
|
117
|
-
const abortMaybe = () => {
|
|
118
|
-
if (isFinalAttempt && (0, parallel_ci_1.isParallelCI)()) {
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
130
|
+
const isFinalAttempt = isThirdAttempt || !isFlaky;
|
|
122
131
|
const page = await browser.newPage();
|
|
123
132
|
testInfo.page = page;
|
|
124
133
|
try {
|
|
@@ -126,7 +135,6 @@ async function runServerAndTests(browser, isSecondAttempt) {
|
|
|
126
135
|
}
|
|
127
136
|
catch (err) {
|
|
128
137
|
logFailure(err, 'an error occurred while starting the server', isFinalAttempt);
|
|
129
|
-
abortMaybe();
|
|
130
138
|
return false;
|
|
131
139
|
}
|
|
132
140
|
let success = await runTests(testInfo, isFinalAttempt);
|
|
@@ -145,14 +153,11 @@ async function runServerAndTests(browser, isSecondAttempt) {
|
|
|
145
153
|
if (success) {
|
|
146
154
|
(0, logTestStatus_1.logPass)();
|
|
147
155
|
}
|
|
148
|
-
else {
|
|
149
|
-
abortMaybe();
|
|
150
|
-
}
|
|
151
156
|
Logs_1.Logs.clearLogs();
|
|
152
157
|
return success;
|
|
153
158
|
}
|
|
154
159
|
async function runTests(testInfo, isFinalAttempt) {
|
|
155
|
-
// Set when user calls
|
|
160
|
+
// Set when user calls run()
|
|
156
161
|
(0, utils_1.assert)(testInfo.runInfo);
|
|
157
162
|
(0, utils_1.assert)(testInfo.afterEach);
|
|
158
163
|
const tests =
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.cliOptions = void 0;
|
|
4
4
|
const parseCli_1 = require("./parseCli");
|
|
5
5
|
(0, parseCli_1.prepare)();
|
|
6
6
|
const verbose = (0, parseCli_1.check)('--verbose');
|
|
@@ -12,11 +12,11 @@ const bail = (0, parseCli_1.check)('--bail');
|
|
|
12
12
|
const exclude = check('--exclude')
|
|
13
13
|
*/
|
|
14
14
|
(0, parseCli_1.validate)();
|
|
15
|
-
const
|
|
15
|
+
const cliOptions = {
|
|
16
16
|
verbose,
|
|
17
17
|
// To inspect a specific test: `$ touch examples/some-example/INSPECT`
|
|
18
18
|
inspect: inspect || !!process.env.TEST_INSPECT,
|
|
19
19
|
debugEsbuild,
|
|
20
|
-
bail
|
|
20
|
+
bail,
|
|
21
21
|
};
|
|
22
|
-
exports.
|
|
22
|
+
exports.cliOptions = cliOptions;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export * from './humanizeTime';
|
|
|
7
7
|
export * from './isTTY';
|
|
8
8
|
export * from './findFiles';
|
|
9
9
|
export * from './logProgress';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './cliOptions';
|
|
11
11
|
export * from './fsWindowsBugWorkaround';
|
|
12
12
|
export * from './isObject';
|
|
13
13
|
export * from './isCallable';
|
package/dist/utils/index.js
CHANGED
|
@@ -23,7 +23,7 @@ __exportStar(require("./humanizeTime"), exports);
|
|
|
23
23
|
__exportStar(require("./isTTY"), exports);
|
|
24
24
|
__exportStar(require("./findFiles"), exports);
|
|
25
25
|
__exportStar(require("./logProgress"), exports);
|
|
26
|
-
__exportStar(require("./
|
|
26
|
+
__exportStar(require("./cliOptions"), exports);
|
|
27
27
|
__exportStar(require("./fsWindowsBugWorkaround"), exports);
|
|
28
28
|
__exportStar(require("./isObject"), exports);
|
|
29
29
|
__exportStar(require("./isCallable"), exports);
|