@brillout/test-e2e 0.2.1 → 0.3.0

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
@@ -13,7 +13,7 @@ declare type LogEntry = {
13
13
  logTimestamp: string;
14
14
  isNotFailure: boolean;
15
15
  };
16
- declare function hasErrorLogs(onlyFailOnBrowserError?: boolean): boolean;
16
+ declare function hasErrorLogs(doNotFailOnWarning?: boolean): boolean;
17
17
  declare function clearLogs(): void;
18
18
  declare function flushLogs(): void;
19
19
  declare function add({ logSource, logText }: {
package/dist/Logs.js CHANGED
@@ -16,7 +16,7 @@ const picocolors_1 = __importDefault(require("picocolors"));
16
16
  const getCurrentTest_1 = require("./getCurrentTest");
17
17
  const getConfig_1 = require("./getConfig");
18
18
  let logEntries = [];
19
- function hasErrorLogs(onlyFailOnBrowserError = false) {
19
+ function hasErrorLogs(doNotFailOnWarning = false) {
20
20
  const logErrors = logEntries.filter(({ logSource, isNotFailure }) => {
21
21
  if (isNotFailure) {
22
22
  return;
@@ -24,7 +24,7 @@ function hasErrorLogs(onlyFailOnBrowserError = false) {
24
24
  if (logSource === 'run() failure') {
25
25
  return true;
26
26
  }
27
- if (!onlyFailOnBrowserError && (logSource === 'Browser Warning' || logSource === 'stderr')) {
27
+ if (!doNotFailOnWarning && (logSource === 'Browser Warning' || logSource === 'stderr')) {
28
28
  return true;
29
29
  }
30
30
  if (logSource === 'Browser Error') {
@@ -1,4 +1,3 @@
1
- /// <reference types="chai-subset" />
2
1
  export type { ChaiPlugin };
3
2
  export type { Expect };
4
3
  import type { use as chaiUse } from 'chai';
@@ -17,7 +17,7 @@ declare type TestInfo = {
17
17
  serverIsReadyMessage?: string | ((log: string) => boolean);
18
18
  serverIsReadyDelay: number;
19
19
  inspect: boolean;
20
- onlyFailOnBrowserError: boolean;
20
+ doNotFailOnWarning: boolean;
21
21
  serverUrl: string;
22
22
  };
23
23
  hasStartedRunning?: boolean;
package/dist/runTests.js CHANGED
@@ -56,7 +56,7 @@ async function runTests(browser) {
56
56
  }
57
57
  done(!!err);
58
58
  testInfo.afterEach(!!err);
59
- const hasErrorLog = Logs_1.Logs.hasErrorLogs(testInfo.runInfo.onlyFailOnBrowserError);
59
+ const hasErrorLog = Logs_1.Logs.hasErrorLogs(testInfo.runInfo.doNotFailOnWarning);
60
60
  const isFailure = err || hasErrorLog;
61
61
  if (isFailure) {
62
62
  logTestsResult(false);
package/dist/setup.d.ts CHANGED
@@ -16,13 +16,13 @@ export { sleep };
16
16
  export { getServerUrl };
17
17
  export { editFile, editFileRevert } from './editFile';
18
18
  declare function skip(reason: string): void;
19
- declare function run(cmd: string, { additionalTimeout, serverIsReadyMessage, serverIsReadyDelay, inspect, cwd, onlyFailOnBrowserError, serverUrl, }?: {
19
+ declare function run(cmd: string, { additionalTimeout, serverIsReadyMessage, serverIsReadyDelay, inspect, cwd, doNotFailOnWarning, serverUrl, }?: {
20
20
  additionalTimeout?: number;
21
21
  serverIsReadyMessage?: string | ((log: string) => boolean);
22
22
  serverIsReadyDelay?: number;
23
23
  inspect?: boolean;
24
24
  cwd?: string;
25
- onlyFailOnBrowserError?: boolean;
25
+ doNotFailOnWarning?: boolean;
26
26
  serverUrl?: string;
27
27
  }): void;
28
28
  declare function autoRetry(test: () => void | Promise<void>, { timeout }?: {
package/dist/setup.js CHANGED
@@ -39,7 +39,7 @@ function skip(reason) {
39
39
  exports.skip = skip;
40
40
  function run(cmd, {
41
41
  //baseUrl = '',
42
- additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect = utils_1.cliConfig.inspect, cwd, onlyFailOnBrowserError = false, serverUrl = serverUrlDefault, } = {}) {
42
+ additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect = utils_1.cliConfig.inspect, cwd, doNotFailOnWarning = false, serverUrl = serverUrlDefault, } = {}) {
43
43
  additionalTimeout += serverIsReadyDelay;
44
44
  const testInfo = (0, getCurrentTest_1.getCurrentTest)();
45
45
  testInfo.runInfo = {
@@ -50,7 +50,7 @@ additionalTimeout = 0, serverIsReadyMessage, serverIsReadyDelay = 1000, inspect
50
50
  serverIsReadyMessage,
51
51
  serverIsReadyDelay,
52
52
  inspect,
53
- onlyFailOnBrowserError,
53
+ doNotFailOnWarning,
54
54
  serverUrl,
55
55
  };
56
56
  if (inspect) {
@@ -192,17 +192,17 @@ async function start() {
192
192
  return exitIsPossible;
193
193
  },
194
194
  async onStdout(data) {
195
- const text = (0, strip_ansi_1.default)(data);
195
+ const log = (0, strip_ansi_1.default)(data);
196
196
  const isServerReady =
197
197
  // Custom
198
- (typeof serverIsReadyMessage === 'string' && text.includes(serverIsReadyMessage)) ||
199
- ((0, utils_1.isCallable)(serverIsReadyMessage) && serverIsReadyMessage(text)) ||
198
+ (typeof serverIsReadyMessage === 'string' && log.includes(serverIsReadyMessage)) ||
199
+ ((0, utils_1.isCallable)(serverIsReadyMessage) && serverIsReadyMessage(log)) ||
200
200
  // Express.js server
201
- text.includes('Server running at') ||
201
+ log.includes('Server running at') ||
202
202
  // npm package `serve`
203
- text.includes('Accepting connections at') ||
203
+ log.includes('Accepting connections at') ||
204
204
  // Vite
205
- (text.includes('Local:') && text.includes('http://localhost:3000/'));
205
+ (log.includes('Local:') && log.includes('http://localhost:3000/'));
206
206
  if (isServerReady) {
207
207
  (0, utils_2.assert)(serverIsReadyDelay);
208
208
  await (0, utils_1.sleep)(serverIsReadyDelay);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {