@brillout/test-e2e 0.5.15 → 0.5.17

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.
@@ -24,7 +24,7 @@ function logFail(reason, isFinalAttempt) {
24
24
  }
25
25
  const { FAIL } = getStatusTags();
26
26
  const color = (s) => picocolors_1.default.red(picocolors_1.default.bold(s));
27
- const msg = `Test ${isFinalAttempt ? FAIL : 'failed'} because ${reason}, see below.`;
27
+ const msg = `Test ${isFinalAttempt ? FAIL : 'failed'} because ${reason}, see below. [TEST_FAILURE]`;
28
28
  console.log(color(msg));
29
29
  }
30
30
  exports.logFail = logFail;
package/dist/runAll.js CHANGED
@@ -27,34 +27,37 @@ 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 logs above for more information.',
30
+ 'Following test files failed, see logs above for more information (search for [TEST_FAILURE]).',
31
31
  ...failedTestFiles.map((testFile) => ` ${testFile}`),
32
32
  ].join('\n'));
33
33
  }
34
34
  }
35
35
  exports.runAll = runAll;
36
36
  async function runTestFiles(testFiles, browser) {
37
- const failedFirstAttempt = [];
37
+ // First attempt
38
+ let failedTestFiles = [];
38
39
  for (const testFile of testFiles) {
39
40
  const success = await buildAndTest(testFile, browser, false);
40
41
  if (!success) {
41
- failedFirstAttempt.push(testFile);
42
+ failedTestFiles.push(testFile);
42
43
  if (utils_1.cliConfig.bail) {
43
- return failedFirstAttempt;
44
+ return failedTestFiles;
44
45
  }
45
46
  }
46
47
  }
47
48
  if (!(0, utils_1.isCI)()) {
48
- return failedFirstAttempt;
49
- }
50
- const failedSecondAttempt = [];
51
- for (const testFile of failedFirstAttempt) {
52
- const success = await buildAndTest(testFile, browser, true);
53
- if (!success) {
54
- failedSecondAttempt.push(testFile);
49
+ return failedTestFiles;
50
+ }
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
+ }
55
58
  }
56
59
  }
57
- return failedSecondAttempt;
60
+ return failedTestFiles;
58
61
  }
59
62
  async function buildAndTest(testFile, browser, isSecondAttempt) {
60
63
  (0, utils_1.assert)(testFile.endsWith('.ts'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {