@brillout/test-e2e 0.6.1 → 0.6.3

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.js CHANGED
@@ -87,7 +87,7 @@ function add({ logSource, logText, loggedAfterExit = false, }) {
87
87
  */
88
88
  function expectLog(logText, { filter: logFilter, allLogs } = {}) {
89
89
  const logList = allLogs ? logEntriesAll : logEntries;
90
- let logsFound = logList.filter((logEntry) => {
90
+ const logsFound = logList.filter((logEntry) => {
91
91
  if (removeAnsi(logEntry).logText.includes(logText)) {
92
92
  logEntry.isNotFailure = true;
93
93
  return true;
@@ -95,13 +95,14 @@ function expectLog(logText, { filter: logFilter, allLogs } = {}) {
95
95
  return false;
96
96
  });
97
97
  if (logsFound.length === 0) {
98
- throw new Error(`The following log was expected but it wasn't logged: "${logText}"`);
98
+ throw new Error(`The following log is expected but it wasn't logged: "${logText}"`);
99
99
  }
100
100
  if (!logFilter)
101
101
  return;
102
- logsFound = logsFound.filter((logEntry) => logFilter(removeAnsi(logEntry)));
103
- if (logsFound.length === 0) {
104
- throw new Error(`The following log was logged as expected, but it didn't match the logFilter() you provided: "${logText}"`);
102
+ const logsFoundAfterFilter = logsFound.filter((logEntry) => logFilter(removeAnsi(logEntry)));
103
+ if (logsFoundAfterFilter.length === 0) {
104
+ console.log(JSON.stringify(logsFound, null, 2));
105
+ throw new Error(`Logs above are matching "${logText}" but don't match the filter you provided.`);
105
106
  }
106
107
  }
107
108
  function removeAnsi(logEntry) {
package/dist/runAll.js CHANGED
@@ -20,9 +20,6 @@ async function runAll(filter) {
20
20
  const hasFailedTestFile = failedTestFiles.length > 0;
21
21
  const hasFailLog = hasFail();
22
22
  if (hasFailedTestFile || hasFailLog) {
23
- // hasFailedTestFile and hasFailLog are redundant
24
- // - When assert.ts calls logFail() this code block isn't run
25
- assert(hasFailedTestFile && hasFailLog);
26
23
  assert(failedTestFiles.length > 0);
27
24
  throw new Error(pc.red(pc.bold([
28
25
  `Following test files failed, see logs above for more information (search for [${TEST_FAIL}]):`,
@@ -5,11 +5,6 @@ export { assertInfo };
5
5
  export { getProjectError };
6
6
  export { errorPrefix as projectErrorPrefix };
7
7
  import { projectInfo } from './projectInfo.js';
8
- import { Logs } from '../Logs.js';
9
- import { getCurrentTest } from '../getCurrentTest.js';
10
- import { logSection } from '../logSection.js';
11
- import { logError } from '../logError.js';
12
- import { logFail } from '../logTestStatus.js';
13
8
  const errorPrefix = `[${projectInfo.npmPackageName}]`;
14
9
  const internalErrorPrefix = `${errorPrefix}[Bug]`;
15
10
  const usageErrorPrefix = `${errorPrefix}[Wrong Usage]`;
@@ -33,12 +28,7 @@ function assert(condition, debugInfo) {
33
28
  `Do not hesitate to reach out as it makes ${projectInfo.projectName} more robust.`,
34
29
  debugStr,
35
30
  ].join(' '));
36
- logFail('a bug occurred in @brillout/test-e2e', true);
37
- logError(internalError, 'BUG');
38
- logDebugInfo();
39
- Logs.logErrorsAndWarnings();
40
- Logs.flushLogs();
41
- throw new Error('Bug. See messages above.');
31
+ throw internalError;
42
32
  }
43
33
  function assertUsage(condition, errorMessage) {
44
34
  if (condition) {
@@ -74,13 +64,3 @@ function assertInfo(condition, errorMessage) {
74
64
  }
75
65
  console.warn(`${infoPrefix} ${errorMessage}`);
76
66
  }
77
- function logDebugInfo() {
78
- logSection('DEBUG INFO');
79
- const testInfo = getCurrentTest();
80
- console.log('testInfo.hasStartedRunning', testInfo.hasStartedRunning);
81
- console.log('testInfo.skipped?.reason', testInfo.skipped?.reason);
82
- console.log('testInfo.runInfo', testInfo.runInfo);
83
- console.log('testInfo.testFile', testInfo.testFile);
84
- console.log('testInfo.testName', testInfo.testName);
85
- console.log('process.platform', process.platform);
86
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",