Skip to content

Commit 4d61fae

Browse files
modernize kv-asset-handler so that we can test is in Node 22+ (#11348)
* modernize kv-asset-handler so that we can test is in Node 22+ * suggestion from Vic * fix exports on the kv-asset-handler package.json * move kv-asset-handler tests back into main test run * only test on Node 22 Node 20 has been in Maintenance for over a year and will become end of life in April 2026. Node 22 entered Maintenance in October and is arguably the most stable and supported version right now. * also test packages on Node 20 and 24 * really don't run interactive-dev tests on Windows * remove redundant service-worker-mock * wait for the old port to be closed * Add resilience to reading and writing the dev registry files * give prisma tests a bit longer to run
1 parent e1b004c commit 4d61fae

File tree

29 files changed

+1264
-1277
lines changed

29 files changed

+1264
-1277
lines changed

.changeset/cruel-hairs-flow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/kv-asset-handler": patch
3+
---
4+
5+
refactor to generate ESM modules and support Node 22+

.changeset/green-poems-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"miniflare": patch
3+
---
4+
5+
Add resilience to reading and writing the dev registry files

.github/actions/install-dependencies/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: "Install Dependencies"
22
description: "Install dependencies, fetching from cache when possible"
33
inputs:
4+
# We run all jobs on Node.js 22 by default, as this is the most stable and supported version right now.
45
node-version:
56
description: the version of Node.js to install
6-
default: 20.19.1
7+
default: 22
78
pnpm-filters:
89
description: space-separated list of pnpm filters to apply (e.g., "wrangler miniflare")
910
default: ""

.github/workflows/c3-e2e.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ on:
66
permissions:
77
contents: read
88

9-
env:
10-
# TODO: switch back to 20.x onces node@20.x includes a fix for https://github.com/nodejs/node/issues/57869
11-
NODE_VERSION: 22
12-
139
jobs:
1410
e2e:
1511
# Runs the non-frameworks C3 E2E tests on all supported operating systems and package managers.
@@ -53,7 +49,6 @@ jobs:
5349
if: steps.changes.outputs.everything_but_markdown == 'true'
5450
uses: ./.github/actions/install-dependencies
5551
with:
56-
node-version: ${{ env.NODE_VERSION }}
5752
turbo-api: ${{ secrets.TURBO_API }}
5853
turbo-team: ${{ secrets.TURBO_TEAM }}
5954
turbo-token: ${{ secrets.TURBO_TOKEN }}

.github/workflows/changesets.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ permissions:
1010
contents: read
1111
# note: no write permissions are needed since the workflow uses GH_ACCESS_TOKEN instead of GITHUB_TOKEN
1212

13-
env:
14-
NODE_VERSION: 24
15-
1613
jobs:
1714
release:
1815
if: ${{ github.repository_owner == 'cloudflare' }}
@@ -30,7 +27,6 @@ jobs:
3027
- name: Install Dependencies
3128
uses: ./.github/actions/install-dependencies
3229
with:
33-
node-version: ${{ env.NODE_VERSION }}
3430
turbo-api: ${{ secrets.TURBO_API }}
3531
turbo-team: ${{ secrets.TURBO_TEAM }}
3632
turbo-token: ${{ secrets.TURBO_TOKEN }}

.github/workflows/deploy-pages-previews.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ jobs:
4343

4444
- name: Install Dependencies
4545
uses: ./.github/actions/install-dependencies
46-
with:
47-
node-version: 22
4846

4947
- name: Build tools and libraries
5048
run: pnpm run build

.github/workflows/e2e.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ jobs:
2020
include:
2121
- os: macos-latest
2222
description: v20, macOS
23-
node: 20.19.1
2423
- os: windows-latest
2524
description: v20, Windows
26-
node: 20.19.1
27-
# we need to use an amd image to run the containers tests, since we build for linux/amd64
2825
- os: ubuntu-latest
2926
description: v20, Linux
30-
node: 20.19.1
3127

3228
runs-on: ${{ matrix.os }}
3329
steps:
@@ -47,7 +43,6 @@ jobs:
4743
if: steps.changes.outputs.everything_but_markdown == 'true'
4844
uses: ./.github/actions/install-dependencies
4945
with:
50-
node-version: ${{ matrix.node }}
5146
turbo-api: ${{ secrets.TURBO_API }}
5247
turbo-team: ${{ secrets.TURBO_TEAM }}
5348
turbo-token: ${{ secrets.TURBO_TOKEN }}
@@ -97,15 +92,11 @@ jobs:
9792
matrix:
9893
include:
9994
- os: macos-latest
100-
description: v20, macOS
101-
node: 20.19.1
95+
description: macOS
10296
- os: windows-latest
103-
description: v20, Windows
104-
node: 20.19.1
105-
# we need to use an amd image to run the containers tests, since we build for linux/amd64
97+
description: Windows
10698
- os: ubuntu-latest
107-
description: v20, Linux
108-
node: 20.19.1
99+
description: Linux
109100
runs-on: ${{ matrix.os }}
110101
steps:
111102
- name: Checkout Repo
@@ -124,7 +115,6 @@ jobs:
124115
if: steps.changes.outputs.everything_but_markdown == 'true'
125116
uses: ./.github/actions/install-dependencies
126117
with:
127-
node-version: ${{ matrix.node }}
128118
turbo-api: ${{ secrets.TURBO_API }}
129119
turbo-team: ${{ secrets.TURBO_TEAM }}
130120
turbo-token: ${{ secrets.TURBO_TOKEN }}

.github/workflows/prerelease.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
turbo-team: ${{ secrets.TURBO_TEAM }}
3636
turbo-token: ${{ secrets.TURBO_TOKEN }}
3737
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
38-
node-version: 22
3938

4039
- run: echo ${{ github.head_ref }}
4140

.github/workflows/test-and-check.yml

Lines changed: 56 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
test:
7676
timeout-minutes: 45
7777
concurrency:
78-
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.node_version }}-test
78+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-test
7979
cancel-in-progress: true
8080

8181
name: ${{ format('Tests ({0})', matrix.description) }}
@@ -85,16 +85,10 @@ jobs:
8585
include:
8686
- os: macos-latest
8787
description: macOS
88-
node_version: 20.19.1
8988
- os: ubuntu-latest
9089
description: Linux
91-
node_version: 20.19.1
9290
- os: windows-latest
9391
description: Windows
94-
node_version: 20.19.1
95-
- os: ubuntu-latest
96-
description: v22, Linux
97-
node_version: 22
9892

9993
runs-on: ${{ matrix.os }}
10094
steps:
@@ -103,7 +97,8 @@ jobs:
10397
with:
10498
fetch-depth: 1
10599

106-
- uses: dorny/paths-filter@v3
100+
- name: Filter changed paths
101+
uses: dorny/paths-filter@v3
107102
id: changes
108103
with:
109104
filters: |
@@ -118,7 +113,6 @@ jobs:
118113
turbo-team: ${{ secrets.TURBO_TEAM }}
119114
turbo-token: ${{ secrets.TURBO_TOKEN }}
120115
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
121-
node-version: ${{ matrix.node_version }}
122116

123117
- name: Bump package versions
124118
if: steps.changes.outputs.everything_but_markdown == 'true'
@@ -139,25 +133,14 @@ jobs:
139133
# We are running the package tests first be able to get early feedback on changes.
140134
# There is no point in running the fixtures if a package is broken.
141135
if: steps.changes.outputs.everything_but_markdown == 'true'
142-
run: pnpm run test:ci --log-order=stream --concurrency=1 --filter="./packages/*" --filter="!@cloudflare/kv-asset-handler"
136+
run: pnpm run test:ci --log-order=stream --concurrency=1 --filter="./packages/*"
143137
env:
144138
NODE_OPTIONS: "--max_old_space_size=8192"
145139
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
146140
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/packages/index.html
147141
CI_OS: ${{ matrix.description }}
148142
NODE_DEBUG: "@cloudflare:vite-plugin"
149143

150-
- name: Run tests (kv-asset-handler only)
151-
# kv-asset-handler tests don't work on Node.js 22
152-
# TODO: put this back in the main packages test run when https://github.com/cloudflare/workers-sdk/pull/11348 is merged
153-
if: steps.changes.outputs.everything_but_markdown == 'true' && matrix.node_version != '22'
154-
run: pnpm run test:ci --log-order=stream --filter="@cloudflare/kv-asset-handler"
155-
env:
156-
NODE_OPTIONS: "--max_old_space_size=8192"
157-
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
158-
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/kv-asset-handler/index.html
159-
CI_OS: ${{ matrix.description }}
160-
161144
- name: Run tests (vite-plugin playgrounds)
162145
if: steps.changes.outputs.everything_but_markdown == 'true'
163146
run: pnpm run test:ci --log-order=stream --filter="@vite-plugin-cloudflare/playground"
@@ -183,5 +166,56 @@ jobs:
183166
if: always()
184167
uses: actions/upload-artifact@v4
185168
with:
186-
name: turbo-runs-${{ matrix.os }}-${{ matrix.node_version }}
169+
name: turbo-runs-${{ matrix.os }}
187170
path: .turbo/runs
171+
172+
# This job runs the main packages' tests on other supported Node.js versions to ensure compatibility.
173+
test-other-node-versions:
174+
timeout-minutes: 45
175+
runs-on: ubuntu-latest
176+
concurrency:
177+
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.node_version }}-test-other-node-versions
178+
cancel-in-progress: true
179+
name: ${{ format('Tests ({0})', matrix.description) }}
180+
strategy:
181+
fail-fast: false
182+
matrix:
183+
include:
184+
- { node_version: 20, description: "Node 20" }
185+
- { node_version: 24, description: "Node 24" }
186+
187+
steps:
188+
- name: Checkout Repo
189+
uses: actions/checkout@v4
190+
with:
191+
fetch-depth: 1
192+
193+
- name: Filter changed paths
194+
uses: dorny/paths-filter@v3
195+
id: changes
196+
with:
197+
filters: |
198+
everything_but_markdown:
199+
- '!**/*.md'
200+
201+
- name: Install Dependencies
202+
if: steps.changes.outputs.everything_but_markdown == 'true'
203+
uses: ./.github/actions/install-dependencies
204+
with:
205+
node-version: ${{ matrix.node_version }}
206+
turbo-api: ${{ secrets.TURBO_API }}
207+
turbo-team: ${{ secrets.TURBO_TEAM }}
208+
turbo-token: ${{ secrets.TURBO_TOKEN }}
209+
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
210+
211+
- name: Run tests (packages)
212+
# We are running the package tests first be able to get early feedback on changes.
213+
# There is no point in running the fixtures if a package is broken.
214+
if: steps.changes.outputs.everything_but_markdown == 'true'
215+
run: pnpm run test:ci --log-order=stream --concurrency=1 --filter="./packages/*"
216+
env:
217+
NODE_OPTIONS: "--max_old_space_size=8192"
218+
WRANGLER_LOG_PATH: ${{ runner.temp }}/wrangler-debug-logs/
219+
TEST_REPORT_PATH: ${{ runner.temp }}/test-report/packages/index.html
220+
CI_OS: ${{ matrix.description }}
221+
NODE_DEBUG: "@cloudflare:vite-plugin"

0 commit comments

Comments
 (0)