Skip to content

Commit ff31e5e

Browse files
authored
Fix Leak Tests on Node 25 & Run Stitching & Router tests in parallel (#1693)
1 parent 095aaf1 commit ff31e5e

File tree

4 files changed

+55
-14
lines changed

4 files changed

+55
-14
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ jobs:
2424
- 22
2525
- 24
2626
- 25
27-
name: Unit / Node v${{matrix.node-version}}
27+
hive-router-runtime:
28+
- 0
29+
- 1
30+
name: Unit / Node v${{matrix.node-version}} / ${{matrix.hive-router-runtime == 1 && 'Router' || 'Stitching'}} Runtime
2831
runs-on: ubuntu-latest
2932
steps:
3033
- name: Checkout
@@ -33,12 +36,10 @@ jobs:
3336
uses: the-guild-org/shared-config/setup@v1
3437
with:
3538
node-version: ${{matrix.node-version}}
36-
- name: Test with Stitching Runtime
39+
- name: Test
3740
run: yarn test
38-
- name: Test with Router Runtime
3941
env:
40-
HIVE_ROUTER_RUNTIME: 1
41-
run: yarn test
42+
HIVE_ROUTER_RUNTIME: ${{matrix.hive-router-runtime}}
4243

4344
unit-bun:
4445
name: Unit / Bun
@@ -74,7 +75,10 @@ jobs:
7475
- 22
7576
- 24
7677
- 25
77-
name: Leaks / Node v${{matrix.node-version}}
78+
hive-router-runtime:
79+
- 0
80+
- 1
81+
name: Leaks / Node v${{matrix.node-version}} / ${{matrix.hive-router-runtime == 1 && 'Router' || 'Stitching'}} Runtime
7882
needs: [unit] # leak tests run unit tests but check for leaks; if unit tests fail, leaks will fail too - avoid confusion by running them in series
7983
runs-on: ubuntu-latest
8084
steps:
@@ -84,16 +88,10 @@ jobs:
8488
uses: the-guild-org/shared-config/setup@v1
8589
with:
8690
node-version: ${{matrix.node-version}}
87-
- name: Test with Stitching Runtime
88-
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
89-
with:
90-
timeout_minutes: 10
91-
max_attempts: 3
92-
command: yarn test:leaks
93-
- name: Test with Router Runtime
91+
- name: Test
9492
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3
9593
env:
96-
HIVE_ROUTER_RUNTIME: 1
94+
HIVE_ROUTER_RUNTIME: ${{matrix.hive-router-runtime}}
9795
with:
9896
timeout_minutes: 10
9997
max_attempts: 3
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/build/index.js b/build/index.js
2+
index 866ad663d0f392c721c39cbcb3be88d19b85fac2..ebd7d6ac7a6793d5dadf848ace3db05e4837d976 100644
3+
--- a/build/index.js
4+
+++ b/build/index.js
5+
@@ -61,9 +61,19 @@ function _jestValidate() {
6+
*/
7+
8+
// some globals we do not want, either because deprecated or we set it ourselves
9+
-const denyList = new Set(['GLOBAL', 'root', 'global', 'globalThis', 'Buffer', 'ArrayBuffer', 'Uint8Array',
10+
-// if env is loaded within a jest test
11+
-'jest-symbol-do-not-touch']);
12+
+const denyList = new Set([
13+
+ "GLOBAL",
14+
+ "root",
15+
+ "global",
16+
+ "globalThis",
17+
+ "Buffer",
18+
+ "ArrayBuffer",
19+
+ "Uint8Array",
20+
+ // if env is loaded within a jest test
21+
+ "jest-symbol-do-not-touch",
22+
+ // Causing `SecurityError: Cannot initialize local storage without a `--localstorage-file` path`
23+
+ "localStorage"
24+
+]);
25+
const nodeGlobals = new Map(Object.getOwnPropertyNames(globalThis).filter(global => !denyList.has(global)).map(nodeGlobalsKey => {
26+
const descriptor = Object.getOwnPropertyDescriptor(globalThis, nodeGlobalsKey);
27+
if (!descriptor) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"esbuild": "0.25.5",
7777
"graphql": "16.12.0",
7878
"ioredis-mock": "patch:[email protected]#~/.yarn/patches/ioredis-mock-npm-8.9.0-530d4422b9.patch",
79+
"jest-environment-node@npm:30.2.0": "patch:jest-environment-node@npm%3A30.2.0#~/.yarn/patches/jest-environment-node-npm-30.2.0-b72db4433a.patch",
7980
"jest-leak-detector": "patch:jest-leak-detector@npm:29.7.0#~/.yarn/patches/jest-leak-detector+29.7.0.patch",
8081
"pkgroll": "patch:pkgroll@npm:2.5.1#~/.yarn/patches/pkgroll-npm-2.5.1-9b062c22ca.patch",
8182
"tar": "7.5.2",

yarn.lock

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16570,6 +16570,21 @@ __metadata:
1657016570
languageName: node
1657116571
linkType: hard
1657216572

16573+
"jest-environment-node@patch:jest-environment-node@npm%3A30.2.0#~/.yarn/patches/jest-environment-node-npm-30.2.0-b72db4433a.patch":
16574+
version: 30.2.0
16575+
resolution: "jest-environment-node@patch:jest-environment-node@npm%3A30.2.0#~/.yarn/patches/jest-environment-node-npm-30.2.0-b72db4433a.patch::version=30.2.0&hash=e5d4cf"
16576+
dependencies:
16577+
"@jest/environment": "npm:30.2.0"
16578+
"@jest/fake-timers": "npm:30.2.0"
16579+
"@jest/types": "npm:30.2.0"
16580+
"@types/node": "npm:*"
16581+
jest-mock: "npm:30.2.0"
16582+
jest-util: "npm:30.2.0"
16583+
jest-validate: "npm:30.2.0"
16584+
checksum: 10c0/f380cff85bbd4d0d5cd56341670f696635a9abb73e1ef4ba21a23c14967b029a64c0dca80ff63d738d7b23d1087e35dc8e9322ccd5aab95e31e663c146ae8dee
16585+
languageName: node
16586+
linkType: hard
16587+
1657316588
"jest-get-type@npm:^29.6.3":
1657416589
version: 29.6.3
1657516590
resolution: "jest-get-type@npm:29.6.3"

0 commit comments

Comments
 (0)