@brillout/test-e2e 0.4.12 → 0.4.13

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/Logs.d.ts CHANGED
@@ -2,9 +2,9 @@ export { expectError };
2
2
  export declare const Logs: {
3
3
  add: typeof add;
4
4
  flushLogs: typeof flushLogs;
5
- logErrors: typeof logErrors;
5
+ logErrorsAndWarnings: typeof logErrorsAndWarnings;
6
6
  clearLogs: typeof clearLogs;
7
- hasErrorLogs: typeof hasErrorLogs;
7
+ hasFailLogs: typeof hasFailLogs;
8
8
  logEagerly: boolean;
9
9
  };
10
10
  declare type LogSource = 'stdout' | 'stderr' | 'Browser Error' | 'Browser Warning' | 'Browser Log' | 'Playwright' | 'run()' | 'run() failure' | 'test()' | 'Connection Error';
@@ -14,9 +14,9 @@ declare type LogEntry = {
14
14
  logTimestamp: string;
15
15
  isNotFailure: boolean;
16
16
  };
17
- declare function hasErrorLogs(failOnWarning: boolean): boolean;
17
+ declare function hasFailLogs(failOnWarning: boolean): boolean;
18
18
  declare function clearLogs(): void;
19
- declare function logErrors(failOnWarning: boolean): void;
19
+ declare function logErrorsAndWarnings(): void;
20
20
  declare function flushLogs(): void;
21
21
  declare function add({ logSource, logText }: {
22
22
  logSource: LogSource;
package/dist/Logs.js CHANGED
@@ -7,9 +7,9 @@ exports.Logs = exports.expectError = void 0;
7
7
  exports.Logs = {
8
8
  add,
9
9
  flushLogs,
10
- logErrors,
10
+ logErrorsAndWarnings,
11
11
  clearLogs,
12
- hasErrorLogs,
12
+ hasFailLogs,
13
13
  logEagerly: false,
14
14
  };
15
15
  const utils_1 = require("./utils");
@@ -18,11 +18,11 @@ const getCurrentTest_1 = require("./getCurrentTest");
18
18
  const getConfig_1 = require("./getConfig");
19
19
  const logSection_1 = require("./logSection");
20
20
  let logEntries = [];
21
- function hasErrorLogs(failOnWarning) {
22
- const errorLogs = getErrorLogs(failOnWarning);
23
- return errorLogs.length > 0;
21
+ function hasFailLogs(failOnWarning) {
22
+ const failLogs = getErrorLogs(failOnWarning);
23
+ return failLogs.length > 0;
24
24
  }
25
- function getErrorLogs(failOnWarning) {
25
+ function getErrorLogs(returnWarnings) {
26
26
  const errorLogs = logEntries.filter(({ logSource, isNotFailure }) => {
27
27
  if (isNotFailure) {
28
28
  return;
@@ -30,7 +30,7 @@ function getErrorLogs(failOnWarning) {
30
30
  if (logSource === 'run() failure') {
31
31
  return true;
32
32
  }
33
- if (failOnWarning && (logSource === 'Browser Warning' || logSource === 'stderr')) {
33
+ if (returnWarnings && (logSource === 'Browser Warning' || logSource === 'stderr')) {
34
34
  return true;
35
35
  }
36
36
  if (logSource === 'Browser Error') {
@@ -43,12 +43,12 @@ function getErrorLogs(failOnWarning) {
43
43
  function clearLogs() {
44
44
  logEntries = [];
45
45
  }
46
- function logErrors(failOnWarning) {
47
- if (!exports.Logs.hasErrorLogs(failOnWarning))
46
+ function logErrorsAndWarnings() {
47
+ const errorAndWarningLogs = getErrorLogs(true);
48
+ if (errorAndWarningLogs.length === 0)
48
49
  return;
49
- (0, logSection_1.logSection)(`ERROR${!failOnWarning ? '' : '/WARNING'} LOGS`);
50
- const errorLogs = getErrorLogs(failOnWarning);
51
- errorLogs.forEach((logEntry) => printLog(logEntry));
50
+ (0, logSection_1.logSection)('ERROR & WARNING LOGS');
51
+ errorAndWarningLogs.forEach((logEntry) => printLog(logEntry));
52
52
  }
53
53
  function flushLogs() {
54
54
  (0, logSection_1.logSection)('ALL LOGS');
package/dist/runAll.js CHANGED
@@ -116,7 +116,7 @@ async function runTests(browser, isSecondAttempt) {
116
116
  testInfo.afterEach(!!err);
117
117
  {
118
118
  const failOnWarning = !testInfo.runInfo.doNotFailOnWarning;
119
- const hasErrorLog = Logs_1.Logs.hasErrorLogs(failOnWarning);
119
+ const hasErrorLog = Logs_1.Logs.hasFailLogs(failOnWarning);
120
120
  const isFailure = err || hasErrorLog;
121
121
  if (isFailure) {
122
122
  if (err) {
@@ -129,7 +129,7 @@ async function runTests(browser, isSecondAttempt) {
129
129
  else {
130
130
  (0, utils_1.assert)(false);
131
131
  }
132
- Logs_1.Logs.logErrors(failOnWarning);
132
+ Logs_1.Logs.logErrorsAndWarnings();
133
133
  Logs_1.Logs.flushLogs();
134
134
  return failure();
135
135
  }
@@ -139,11 +139,11 @@ async function runTests(browser, isSecondAttempt) {
139
139
  // Check whether stderr emitted during testInfo.terminateServer()
140
140
  {
141
141
  const failOnWarning = true;
142
- if (Logs_1.Logs.hasErrorLogs(failOnWarning) &&
142
+ if (Logs_1.Logs.hasFailLogs(failOnWarning) &&
143
143
  // See comments about taskkill in src/setup.ts
144
144
  !(0, utils_1.isWindows)()) {
145
145
  (0, logTestStatus_1.logFail)(`${getErrorType(failOnWarning)} occurred during server termination`, isFinalAttempt);
146
- Logs_1.Logs.logErrors(failOnWarning);
146
+ Logs_1.Logs.logErrorsAndWarnings();
147
147
  Logs_1.Logs.flushLogs();
148
148
  return failure();
149
149
  }
@@ -34,7 +34,7 @@ function assert(condition, debugInfo) {
34
34
  (0, logTestStatus_1.logFail)('a bug occurred in @brillout/test-e2e', true);
35
35
  (0, logError_1.logError)(internalError, 'BUG');
36
36
  logDebugInfo();
37
- Logs_1.Logs.logErrors(true);
37
+ Logs_1.Logs.logErrorsAndWarnings();
38
38
  Logs_1.Logs.flushLogs();
39
39
  throw new Error('Bug. See messages above.');
40
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {