@brillout/test-e2e 0.1.18 → 0.1.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/Logs.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare const Logs: {
6
6
  hasError: typeof hasError;
7
7
  flushEagerly: boolean;
8
8
  };
9
- declare type LogSource = 'stdout' | 'stderr' | 'Browser Error' | 'Browser Warning' | 'Browser Log' | 'Playwright' | 'run()' | 'test()' | 'Connection Error';
9
+ declare type LogSource = 'stdout' | 'stderr' | 'Browser Error' | 'Browser Warning' | 'Browser Log' | 'Playwright' | 'run()' | 'run() failure' | 'test()' | 'Connection Error';
10
10
  declare type LogEntry = {
11
11
  logSource: LogSource;
12
12
  logText: string;
package/dist/Logs.js CHANGED
@@ -22,6 +22,9 @@ function hasError(onlyFailOnBrowserError) {
22
22
  if (isNotFailure) {
23
23
  return;
24
24
  }
25
+ if (logSource === 'run() failure') {
26
+ return true;
27
+ }
25
28
  if (!onlyFailOnBrowserError && (logSource === 'Browser Warning' || logSource === 'stderr')) {
26
29
  return true;
27
30
  }
@@ -106,15 +109,23 @@ function printLog(logEntry) {
106
109
  }
107
110
  function colorize(logSource) {
108
111
  const { bold } = picocolors_1.default;
109
- if (logSource === 'stderr' || logSource === 'Browser Error' || logSource === 'Connection Error')
112
+ if (logSource === 'stderr' ||
113
+ logSource === 'Browser Error' ||
114
+ logSource === 'Connection Error' ||
115
+ logSource === 'run() failure') {
110
116
  return bold(picocolors_1.default.red(logSource));
111
- if (logSource === 'Browser Warning')
117
+ }
118
+ if (logSource === 'Browser Warning') {
112
119
  return bold(picocolors_1.default.yellow(logSource));
113
- if (logSource === 'stdout' || logSource === 'Browser Log')
120
+ }
121
+ if (logSource === 'stdout' || logSource === 'Browser Log') {
114
122
  return bold(picocolors_1.default.blue(logSource));
115
- if (logSource === 'Playwright')
123
+ }
124
+ if (logSource === 'Playwright') {
116
125
  return bold(picocolors_1.default.magenta(logSource));
117
- if (logSource === 'run()' || logSource === 'test()')
126
+ }
127
+ if (logSource === 'run()' || logSource === 'test()') {
118
128
  return bold(picocolors_1.default.cyan(logSource));
129
+ }
119
130
  (0, utils_1.assert)(false);
120
131
  }
package/dist/setup.js CHANGED
@@ -151,9 +151,10 @@ async function start() {
151
151
  _resolve(runProcess);
152
152
  };
153
153
  rejectServerStart = async (err) => {
154
+ (0, utils_2.assert)(getRunInfo().cmd === cmd);
154
155
  done(true);
155
156
  Logs_1.Logs.add({
156
- logSource: 'stderr',
157
+ logSource: 'run() failure',
157
158
  logText: String(err),
158
159
  });
159
160
  clearTimeout(serverStartTimeout);
@@ -293,7 +294,8 @@ function execRunScript({ onStdout, onStderr, onError, onExit, }) {
293
294
  proc.stdin.on('data', async (data) => {
294
295
  onError(new Error(`Command is \`${cmd}\` (${cwd}) is invoking \`stdin\`: ${data}.`));
295
296
  });
296
- proc.stdout.on('data', async (data) => {
297
+ proc.stdout.on('data', (data) => {
298
+ (0, utils_2.assert)(getRunInfo().cmd === cmd);
297
299
  data = data.toString();
298
300
  Logs_1.Logs.add({
299
301
  logSource: 'stdout',
@@ -301,7 +303,8 @@ function execRunScript({ onStdout, onStderr, onError, onExit, }) {
301
303
  });
302
304
  onStdout?.(data);
303
305
  });
304
- proc.stderr.on('data', async (data) => {
306
+ proc.stderr.on('data', (data) => {
307
+ (0, utils_2.assert)(getRunInfo().cmd === cmd);
305
308
  data = data.toString();
306
309
  Logs_1.Logs.add({
307
310
  logSource: 'stderr',
@@ -309,7 +312,8 @@ function execRunScript({ onStdout, onStderr, onError, onExit, }) {
309
312
  });
310
313
  onStderr?.(data);
311
314
  });
312
- proc.on('exit', async (code) => {
315
+ proc.on('exit', (code) => {
316
+ (0, utils_2.assert)(getRunInfo().cmd === cmd);
313
317
  const exitIsPossible = onExit();
314
318
  const isSuccessCode = [0, null].includes(code) || (isWindows() && code === 1);
315
319
  const isExpected = isSuccessCode && exitIsPossible;
@@ -317,7 +321,7 @@ function execRunScript({ onStdout, onStderr, onError, onExit, }) {
317
321
  const errMsg = `Unexpected premature process termination, exit code: ${code}`;
318
322
  Logs_1.Logs.add({
319
323
  logText: errMsg,
320
- logSource: 'stderr',
324
+ logSource: 'run() failure',
321
325
  });
322
326
  onError(new Error(errMsg));
323
327
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {