@brillout/test-e2e 0.5.17 → 0.5.19

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
@@ -28,7 +28,7 @@ async function buildTs(entry, outfile) {
28
28
  fs_1.default.unlinkSync(sourceMapFile);
29
29
  }
30
30
  const clean = () => {
31
- if (utils_1.cliConfig.debugEsbuild) {
31
+ if (utils_1.cliOptions.debugEsbuild) {
32
32
  return;
33
33
  }
34
34
  fs_1.default.unlinkSync(`${outfile}`);
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.cliConfig.inspect, cwd, doNotFailOnWarning, serverUrl, isFlaky, } = {}) {
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.cliConfig.verbose) {
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,30 +35,46 @@ 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
40
  const success = await buildAndTest(testFile, browser, false);
41
41
  if (!success) {
42
42
  failedTestFiles.push(testFile);
43
- if (utils_1.cliConfig.bail) {
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
  }
51
- // Second & third attempt
52
- for (let n = 1; n <= 2; n++) {
53
- for (const testFile of failedTestFiles) {
54
- const success = await buildAndTest(testFile, browser, true);
55
- if (success) {
56
- failedTestFiles = failedTestFiles.filter((t) => t !== testFile);
57
+ else {
58
+ // Second & third attempt
59
+ for (let i = 0; i <= 1; i++) {
60
+ console.log((i === 0 ? 'SECOND' : 'THIRD') + '_ATTEMPT');
61
+ for (const testFile of failedTestFiles) {
62
+ const success = await buildAndTest(testFile, browser, i === 1);
63
+ if (success) {
64
+ failedTestFiles = failedTestFiles.filter((t) => t !== testFile);
65
+ }
57
66
  }
58
67
  }
68
+ return failedTestFiles;
59
69
  }
60
- return failedTestFiles;
61
70
  }
62
- async function buildAndTest(testFile, browser, isSecondAttempt) {
71
+ function isFlaky() {
72
+ const testInfo = (0, getCurrentTest_1.getCurrentTest)();
73
+ // Set when user calls run()
74
+ (0, utils_1.assert)(testInfo.runInfo);
75
+ return testInfo.runInfo.isFlaky;
76
+ }
77
+ async function buildAndTest(testFile, browser, isThirdAttempt) {
63
78
  (0, utils_1.assert)(testFile.endsWith('.ts'));
64
79
  const testFileJs = testFile.replace('.ts', '.mjs');
65
80
  (0, utils_1.assert)(testFileJs.endsWith('.mjs'));
@@ -100,22 +115,15 @@ async function buildAndTest(testFile, browser, isSecondAttempt) {
100
115
  (0, logTestStatus_1.logPass)();
101
116
  return true;
102
117
  }
103
- const success = await runServerAndTests(browser, isSecondAttempt);
118
+ const success = await runServerAndTests(browser, isThirdAttempt);
104
119
  (0, getCurrentTest_2.setCurrentTest)(null);
105
120
  return success;
106
121
  }
107
- async function runServerAndTests(browser, isSecondAttempt) {
122
+ async function runServerAndTests(browser, isThirdAttempt) {
108
123
  const testInfo = (0, getCurrentTest_1.getCurrentTest)();
109
- // Set when user calls run()
110
- (0, utils_1.assert)(testInfo.runInfo);
111
124
  (0, utils_1.assert)(testInfo.startServer);
112
125
  (0, utils_1.assert)(testInfo.terminateServer);
113
- const isFinalAttempt = isSecondAttempt || !testInfo.runInfo.isFlaky;
114
- const abortMaybe = () => {
115
- if (isFinalAttempt && (0, parallel_ci_1.isParallelCI)()) {
116
- process.exit(1);
117
- }
118
- };
126
+ const isFinalAttempt = isThirdAttempt || !isFlaky();
119
127
  const page = await browser.newPage();
120
128
  testInfo.page = page;
121
129
  try {
@@ -123,7 +131,6 @@ async function runServerAndTests(browser, isSecondAttempt) {
123
131
  }
124
132
  catch (err) {
125
133
  logFailure(err, 'an error occurred while starting the server', isFinalAttempt);
126
- abortMaybe();
127
134
  return false;
128
135
  }
129
136
  let success = await runTests(testInfo, isFinalAttempt);
@@ -142,14 +149,11 @@ async function runServerAndTests(browser, isSecondAttempt) {
142
149
  if (success) {
143
150
  (0, logTestStatus_1.logPass)();
144
151
  }
145
- else {
146
- abortMaybe();
147
- }
148
152
  Logs_1.Logs.clearLogs();
149
153
  return success;
150
154
  }
151
155
  async function runTests(testInfo, isFinalAttempt) {
152
- // Set when user calls `run()`
156
+ // Set when user calls run()
153
157
  (0, utils_1.assert)(testInfo.runInfo);
154
158
  (0, utils_1.assert)(testInfo.afterEach);
155
159
  const tests =
@@ -1,5 +1,5 @@
1
- export { cliConfig };
2
- declare const cliConfig: {
1
+ export { cliOptions };
2
+ declare const cliOptions: {
3
3
  verbose: boolean;
4
4
  inspect: boolean;
5
5
  debugEsbuild: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cliConfig = void 0;
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 cliConfig = {
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.cliConfig = cliConfig;
22
+ exports.cliOptions = cliOptions;
@@ -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 './cliConfig';
10
+ export * from './cliOptions';
11
11
  export * from './fsWindowsBugWorkaround';
12
12
  export * from './isObject';
13
13
  export * from './isCallable';
@@ -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("./cliConfig"), exports);
26
+ __exportStar(require("./cliOptions"), exports);
27
27
  __exportStar(require("./fsWindowsBugWorkaround"), exports);
28
28
  __exportStar(require("./isObject"), exports);
29
29
  __exportStar(require("./isCallable"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.5.17",
3
+ "version": "0.5.19",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {