@brillout/test-e2e 0.5.18 → 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,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
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
  }
@@ -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, true);
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,13 @@ async function runTestFiles(testFiles, browser) {
62
68
  return failedTestFiles;
63
69
  }
64
70
  }
65
- 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) {
66
78
  (0, utils_1.assert)(testFile.endsWith('.ts'));
67
79
  const testFileJs = testFile.replace('.ts', '.mjs');
68
80
  (0, utils_1.assert)(testFileJs.endsWith('.mjs'));
@@ -103,22 +115,15 @@ async function buildAndTest(testFile, browser, isSecondAttempt) {
103
115
  (0, logTestStatus_1.logPass)();
104
116
  return true;
105
117
  }
106
- const success = await runServerAndTests(browser, isSecondAttempt);
118
+ const success = await runServerAndTests(browser, isThirdAttempt);
107
119
  (0, getCurrentTest_2.setCurrentTest)(null);
108
120
  return success;
109
121
  }
110
- async function runServerAndTests(browser, isSecondAttempt) {
122
+ async function runServerAndTests(browser, isThirdAttempt) {
111
123
  const testInfo = (0, getCurrentTest_1.getCurrentTest)();
112
- // Set when user calls run()
113
- (0, utils_1.assert)(testInfo.runInfo);
114
124
  (0, utils_1.assert)(testInfo.startServer);
115
125
  (0, utils_1.assert)(testInfo.terminateServer);
116
- const isFinalAttempt = isSecondAttempt || !testInfo.runInfo.isFlaky;
117
- const abortMaybe = () => {
118
- if (isFinalAttempt && (0, parallel_ci_1.isParallelCI)()) {
119
- process.exit(1);
120
- }
121
- };
126
+ const isFinalAttempt = isThirdAttempt || !isFlaky();
122
127
  const page = await browser.newPage();
123
128
  testInfo.page = page;
124
129
  try {
@@ -126,7 +131,6 @@ async function runServerAndTests(browser, isSecondAttempt) {
126
131
  }
127
132
  catch (err) {
128
133
  logFailure(err, 'an error occurred while starting the server', isFinalAttempt);
129
- abortMaybe();
130
134
  return false;
131
135
  }
132
136
  let success = await runTests(testInfo, isFinalAttempt);
@@ -145,14 +149,11 @@ async function runServerAndTests(browser, isSecondAttempt) {
145
149
  if (success) {
146
150
  (0, logTestStatus_1.logPass)();
147
151
  }
148
- else {
149
- abortMaybe();
150
- }
151
152
  Logs_1.Logs.clearLogs();
152
153
  return success;
153
154
  }
154
155
  async function runTests(testInfo, isFinalAttempt) {
155
- // Set when user calls `run()`
156
+ // Set when user calls run()
156
157
  (0, utils_1.assert)(testInfo.runInfo);
157
158
  (0, utils_1.assert)(testInfo.afterEach);
158
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.18",
3
+ "version": "0.5.19",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {