@brillout/test-e2e 0.5.5 → 0.5.6

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.
Files changed (2) hide show
  1. package/dist/runAll.js +16 -10
  2. package/package.json +1 -1
package/dist/runAll.js CHANGED
@@ -17,6 +17,18 @@ async function runAll(filter) {
17
17
  await (0, getConfig_1.loadConfig)();
18
18
  const testFiles = await (0, findTestFiles_1.findTestFiles)(filter);
19
19
  const browser = await (0, getBrowser_1.getBrowser)();
20
+ const hasFailedTestFile = await runTestFiles(testFiles, browser);
21
+ await browser.close();
22
+ const hasFailLog = (0, logTestStatus_1.hasFail)();
23
+ if (hasFailedTestFile || hasFailLog) {
24
+ // hasFailedTestFile and hasFailLog are redundant
25
+ // - When assert.ts calls logFail() this code block isn't run
26
+ (0, utils_1.assert)(hasFailedTestFile && hasFailLog);
27
+ throw new Error('Following tests failed, see logs above for more information.');
28
+ }
29
+ }
30
+ exports.runAll = runAll;
31
+ async function runTestFiles(testFiles, browser) {
20
32
  const failedFirstAttempt = [];
21
33
  for (const testFile of testFiles) {
22
34
  const success = await buildAndTest(testFile, browser, false);
@@ -24,6 +36,9 @@ async function runAll(filter) {
24
36
  failedFirstAttempt.push(testFile);
25
37
  }
26
38
  }
39
+ if (!(0, utils_1.isCI)()) {
40
+ return failedFirstAttempt.length > 0;
41
+ }
27
42
  const failedSecondAttempt = [];
28
43
  for (const testFile of failedFirstAttempt) {
29
44
  const success = await buildAndTest(testFile, browser, true);
@@ -31,17 +46,8 @@ async function runAll(filter) {
31
46
  failedSecondAttempt.push(testFile);
32
47
  }
33
48
  }
34
- await browser.close();
35
- const hasFailLog = (0, logTestStatus_1.hasFail)();
36
- const hasFailedTestFile = failedSecondAttempt.length > 0;
37
- if (hasFailedTestFile || hasFailLog) {
38
- // hasFailedTestFile and hasFailLog are redundant
39
- // - When assert.ts calls logFail() this code block isn't run
40
- (0, utils_1.assert)(hasFailedTestFile && hasFailLog);
41
- throw new Error('Following tests failed, see logs above for more information.');
42
- }
49
+ return failedSecondAttempt.length > 0;
43
50
  }
44
- exports.runAll = runAll;
45
51
  async function buildAndTest(testFile, browser, isSecondAttempt) {
46
52
  (0, utils_1.assert)(testFile.endsWith('.ts'));
47
53
  const testFileJs = testFile.replace('.ts', '.mjs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {