@whatwg-node/node-fetch 0.5.18-alpha-20240726152542-5f316782934ecd79aef9ea23affd78bb05e47164 → 0.5.18-alpha-20240726153005-ce5d304c2d2f79f6b44b7fc5a6ac4ec231b76090

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.
Files changed (3) hide show
  1. package/cjs/utils.js +19 -17
  2. package/esm/utils.js +19 -17
  3. package/package.json +1 -1
package/cjs/utils.js CHANGED
@@ -20,23 +20,25 @@ function patchReadableFromWeb() {
20
20
  }
21
21
  return originalReadableFromWeb(stream);
22
22
  }
23
- if (typeof jest === 'object' &&
24
- typeof afterEach === 'function' &&
25
- originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
26
- // To relax jest, we should remove the patch after each test
27
- beforeEach(() => {
28
- if (stream_1.Readable.fromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
29
- stream_1.Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
30
- }
31
- });
32
- afterEach(() => {
33
- if (stream_1.Readable.fromWeb.name === 'ReadableFromWebPatchedByWhatWgNode') {
34
- stream_1.Readable.fromWeb = originalReadableFromWeb;
35
- }
36
- });
37
- }
38
- else if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
39
- stream_1.Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
23
+ if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
24
+ if (typeof jest === 'object' &&
25
+ typeof beforeEach === 'function' &&
26
+ typeof afterEach === 'function') {
27
+ // To relax jest, we should remove the patch after each test
28
+ beforeEach(() => {
29
+ if (stream_1.Readable.fromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
30
+ stream_1.Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
31
+ }
32
+ });
33
+ afterEach(() => {
34
+ if (stream_1.Readable.fromWeb.name === 'ReadableFromWebPatchedByWhatWgNode') {
35
+ stream_1.Readable.fromWeb = originalReadableFromWeb;
36
+ }
37
+ });
38
+ }
39
+ else {
40
+ stream_1.Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
41
+ }
40
42
  }
41
43
  }
42
44
  catch (e) {
package/esm/utils.js CHANGED
@@ -12,23 +12,25 @@ export function patchReadableFromWeb() {
12
12
  }
13
13
  return originalReadableFromWeb(stream);
14
14
  }
15
- if (typeof jest === 'object' &&
16
- typeof afterEach === 'function' &&
17
- originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
18
- // To relax jest, we should remove the patch after each test
19
- beforeEach(() => {
20
- if (Readable.fromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
21
- Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
22
- }
23
- });
24
- afterEach(() => {
25
- if (Readable.fromWeb.name === 'ReadableFromWebPatchedByWhatWgNode') {
26
- Readable.fromWeb = originalReadableFromWeb;
27
- }
28
- });
29
- }
30
- else if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
31
- Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
15
+ if (originalReadableFromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
16
+ if (typeof jest === 'object' &&
17
+ typeof beforeEach === 'function' &&
18
+ typeof afterEach === 'function') {
19
+ // To relax jest, we should remove the patch after each test
20
+ beforeEach(() => {
21
+ if (Readable.fromWeb.name !== 'ReadableFromWebPatchedByWhatWgNode') {
22
+ Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
23
+ }
24
+ });
25
+ afterEach(() => {
26
+ if (Readable.fromWeb.name === 'ReadableFromWebPatchedByWhatWgNode') {
27
+ Readable.fromWeb = originalReadableFromWeb;
28
+ }
29
+ });
30
+ }
31
+ else {
32
+ Readable.fromWeb = ReadableFromWebPatchedByWhatWgNode;
33
+ }
32
34
  }
33
35
  }
34
36
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.5.18-alpha-20240726152542-5f316782934ecd79aef9ea23affd78bb05e47164",
3
+ "version": "0.5.18-alpha-20240726153005-ce5d304c2d2f79f6b44b7fc5a6ac4ec231b76090",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {