@brillout/test-e2e 0.4.4 → 0.4.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.
package/dist/Logs.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare const Logs: {
5
5
  logErrors: typeof logErrors;
6
6
  clearLogs: typeof clearLogs;
7
7
  hasErrorLogs: typeof hasErrorLogs;
8
- flushEagerly: boolean;
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';
11
11
  declare type LogEntry = {
package/dist/Logs.js CHANGED
@@ -10,7 +10,7 @@ exports.Logs = {
10
10
  logErrors,
11
11
  clearLogs,
12
12
  hasErrorLogs,
13
- flushEagerly: false,
13
+ logEagerly: false,
14
14
  };
15
15
  const utils_1 = require("./utils");
16
16
  const picocolors_1 = __importDefault(require("picocolors"));
@@ -74,8 +74,8 @@ function add({ logSource, logText }) {
74
74
  isNotFailure,
75
75
  };
76
76
  logEntries.push(logEntry);
77
- if (exports.Logs.flushEagerly) {
78
- flushLogs();
77
+ if (exports.Logs.logEagerly) {
78
+ printLog(logEntry);
79
79
  }
80
80
  }
81
81
  function expectError(logFilter) {
package/dist/setup.js CHANGED
@@ -51,7 +51,7 @@ additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect
51
51
  serverUrl,
52
52
  };
53
53
  if (inspect) {
54
- Logs_1.Logs.flushEagerly = true;
54
+ Logs_1.Logs.logEagerly = true;
55
55
  }
56
56
  let runProcess = null;
57
57
  testInfo.startServer = async () => {
@@ -308,23 +308,24 @@ function execRunScript({ onStdout, onFailure, onExit, }) {
308
308
  await terminate(true);
309
309
  onFailure(err);
310
310
  };
311
- proc.stdin.on('data', async (data) => {
311
+ proc.stdin.on('data', async (chunk) => {
312
+ const data = String(chunk);
312
313
  await exitAndFail(new Error(`Command is \`${cmd}\` (${cwd}) is invoking \`stdin\`: ${data}.`));
313
314
  });
314
- proc.stdout.on('data', (data) => {
315
+ proc.stdout.on('data', (chunk) => {
316
+ const data = String(chunk);
315
317
  assertNotExited(data);
316
318
  (0, utils_2.assert)(getRunInfo().cmd === cmd);
317
- data = data.toString();
318
319
  Logs_1.Logs.add({
319
320
  logSource: 'stdout',
320
321
  logText: data,
321
322
  });
322
323
  onStdout?.(data);
323
324
  });
324
- proc.stderr.on('data', async (data) => {
325
+ proc.stderr.on('data', async (chunk) => {
326
+ const data = String(chunk);
325
327
  assertNotExited(data);
326
328
  (0, utils_2.assert)(getRunInfo().cmd === cmd);
327
- data = data.toString();
328
329
  Logs_1.Logs.add({
329
330
  logSource: 'stderr',
330
331
  logText: data,
@@ -363,10 +364,7 @@ function execRunScript({ onStdout, onFailure, onExit, }) {
363
364
  return;
364
365
  Logs_1.Logs.logErrors(true);
365
366
  Logs_1.Logs.flushLogs();
366
- console.log('getCurrentTest()', (0, getCurrentTest_1.getCurrentTest)());
367
- console.log('data', data);
368
- console.log('cmd', cmd);
369
- console.log('process.platform', process.platform);
367
+ logDebugInfo(data);
370
368
  (0, utils_2.assert)(false);
371
369
  }
372
370
  function processHasExited() {
@@ -495,3 +493,16 @@ function getPort() {
495
493
  (0, utils_2.assert)(/\d+/.test(port), { serverUrl });
496
494
  return port;
497
495
  }
496
+ function logDebugInfo(data) {
497
+ console.log('vvvvv DEBUG INFO vvvvv');
498
+ const testInfo = (0, getCurrentTest_1.getCurrentTest)();
499
+ console.log('testInfo.hasStartedRunning', testInfo.hasStartedRunning);
500
+ console.log('testInfo.skipped', testInfo.skipped);
501
+ console.log('testInfo.runInfo', testInfo.runInfo);
502
+ console.log('testInfo.testFile', testInfo.testFile);
503
+ console.log('testInfo.testName', testInfo.testName);
504
+ console.log('data', data);
505
+ console.log('data.length', data.length);
506
+ console.log('process.platform', process.platform);
507
+ console.log('^^^^^ DEBUG INFO ^^^^^');
508
+ }
@@ -4,5 +4,6 @@ exports.cliConfig = void 0;
4
4
  const cliArgs = process.argv.slice(2);
5
5
  exports.cliConfig = {
6
6
  debugEsbuild: cliArgs.includes('--debug-esbuild'),
7
- inspect: cliArgs.includes('--inspect'),
7
+ // To inspect a specific test: `$ touch examples/some-example/INSPECT`
8
+ inspect: cliArgs.includes('--inspect') || !!process.env.TEST_INSPECT,
8
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {