@brillout/test-e2e 0.6.15 → 0.6.16

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/fetch.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export { fetch };
1
+ export { fetchAndLogError as fetch };
2
2
  export { fetchHtml };
3
- import type { RequestInfo, RequestInit, Response } from 'node-fetch';
4
3
  declare function fetchHtml(pathname: string): Promise<string>;
5
- declare function fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
4
+ declare function fetchAndLogError(...args: Parameters<typeof fetch>): Promise<Response>;
package/dist/fetch.js CHANGED
@@ -1,33 +1,22 @@
1
- export { fetch };
1
+ export { fetchAndLogError as fetch };
2
2
  export { fetchHtml };
3
3
  import { getServerUrl } from './getCurrentTest.js';
4
- import fetch_ from 'node-fetch';
5
4
  import { Logs } from './Logs.js';
6
5
  async function fetchHtml(pathname) {
7
- const response = await fetch(getServerUrl() + pathname);
6
+ const response = await fetchAndLogError(getServerUrl() + pathname);
8
7
  const html = await response.text();
9
8
  return html;
10
9
  }
11
- async function fetch(url, init) {
10
+ async function fetchAndLogError(...args) {
12
11
  try {
13
- // @ts-ignore
14
- //
15
- // I don't know why but [transition to ESM](https://github.com/brillout/test-e2e/commit/9b0822a4f5bf787de5a150173f3eeffcfa7ebc5c) broke the default importing of the node-fetch types.
16
- //
17
- // The following used to work but doens't anymore:
18
- // ```js
19
- // async function fetch(...args: Parameters<typeof fetch_>) {
20
- // // ...
21
- // }
22
- // ```
23
- return await fetch_(url, init);
12
+ return await fetch(...args);
24
13
  }
25
14
  catch (err) {
15
+ const url = args[0];
16
+ const init = args[1];
26
17
  Logs.add({
27
18
  logSource: 'Connection Error',
28
- logText: `Couldn't connect to \`${url}\`. Args: \`${JSON.stringify(init)}\`. Err: \`${
29
- // @ts-ignore
30
- err.message}\``,
19
+ logText: `Couldn't connect to \`${url}\`. Args: \`${JSON.stringify(init)}\`. Err: \`${err.message}\``,
31
20
  });
32
21
  throw new Error("Couldn't connect to server. See `Connection Error` log for more details.");
33
22
  }
package/dist/index.d.ts CHANGED
@@ -13,3 +13,4 @@ export { skip } from './skip.js';
13
13
  export { isMinNodeVersion, isCI, isLinux, isWindows, isMac, sleep } from './utils.js';
14
14
  export { getServerUrl } from './getCurrentTest.js';
15
15
  export { runCommandThatTerminates } from './runCommandThatTerminates.js';
16
+ export type { TolerateError } from './Logs/isTolerateError.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brillout/test-e2e",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "bin": "./bin.js",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -10,7 +10,6 @@
10
10
  "chai": "^4.3.6",
11
11
  "esbuild": "^0.23.0",
12
12
  "fast-glob": "^3.2.12",
13
- "node-fetch": "^2.6.1",
14
13
  "pixelmatch": "^5.3.0",
15
14
  "playwright-chromium": "^1.22.2",
16
15
  "pngjs": "^6.0.0",
@@ -22,7 +21,6 @@
22
21
  "@brillout/release-me": "^0.4.3",
23
22
  "@types/chai": "^4.3.3",
24
23
  "@types/node": "^15.6.1",
25
- "@types/node-fetch": "^2.5.12",
26
24
  "@types/pixelmatch": "^5.2.4",
27
25
  "@types/pngjs": "^6.0.1",
28
26
  "@types/source-map-support": "^0.5.6",